tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Possible issue in Win64 tcc with returning a struct?


From: Allan Crossman
Subject: [Tinycc-devel] Possible issue in Win64 tcc with returning a struct?
Date: Thu, 11 Jun 2015 03:27:05 +0100
User-agent: Roundcube Webmail/1.0.3

Hi -

My C is quite bad, so it's possible the fault lies in me rather than tcc. However, the following code seems OK to me but produces an unexpected result in the 64-bit version of tcc 0.9.26 for Windows:

#include <stdio.h>

struct test_struct {
    char member;
};

struct test_struct function (void)
{
    struct test_struct bar;
    bar.member = 'A';
    return bar;
}

int main (void)
{
    struct test_struct foo;
    foo = function();
    printf("Result: '%c' (should be 'A')\n", foo.member);
    return 0;
}

The struct returned from the function seems to be zeroed for some reason. This code works OK in the 32-bit version, however. If I've made some stupid error perhaps you can tell me.

Thanks,
Allan Crossman




reply via email to

[Prev in Thread] Current Thread [Next in Thread]