#include <stdio.h>

void UnspecifiedSideEffectInExpression(int c)
{
        int x = 0, y = 0, z = 20, t = 30, *p, *q;

        x = c;
        y = x++ + x++;
        printf("x = %d, y = %d\n", x, y);

        //Comment out the following code to get a different result
        p = (c&2) ? &x : &t;
        printf("*p = %d\n", *p);

}

int main()
{
        UnspecifiedSideEffectInExpression(1);

        return 0;
}


-- 
           Summary: Calculation on y = x++ + x++ depends on following
                    statements
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: eric dot liu at uniquesoft dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44918

Reply via email to