Hi all,
        Firstly, I want to thank gcc developers for the wonderful compiler 
suite.

I ran into a problem. I am not whether this is regression or not. I compiled the following code using gcc-4.2.3 ubuntu 8.04 x86-64 and gcc-4.1.2 fedora 8 i686

struct abc {
        int a;
        int b;
};

void postfix(void)
{
        struct abc abc;
        abc.b = 16;
        abc.a = 17;
        abc.a = abc.a++ % abc.b;
        printf("postfix a %d\n", abc.a);
}


        The output that I get when postfix function is called is:
postfix a 18

        I expected the result to be something like this:
postfix a 1

However when I compile the code using gcc-3.4 on fedora 8 i686. The result is :

postfix a 1

which is the result I expected. So, is the result given by gcc version 4 compliant with the C standard or a bug? If it is compliant with the C standard, can somebody care to explain it to me why it behaves in such a way?

        Thank you in advance.

Regards,
Ang Way Chuang
        

Reply via email to