Bug 12569

Summary: Incorrect result on pathological code
Product: gcc Reporter: Zombywuf <s0094247>
Component: cAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED DUPLICATE    
Severity: minor CC: gcc-bugs
Priority: P3    
Version: 3.2.2   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:

Description Zombywuf 2003-10-10 14:57:51 UTC
int a;
a = 2;
printf ("%d\n", --a + a++); /* Should be 2, produces 2 */
a = 2;
printf ("%d\n", a++ + --a); /* Should be 4, produces 2 */
if ((--a + a++) == (a++ + --a))
    printf ("This bit however does not get executed\n");

Yes it's pathological but could be indicative of something worse.
Comment 1 Andreas Schwab 2003-10-10 15:20:31 UTC
This is invalid, you are trying to modify an object twice between two sequence 
points. 

*** This bug has been marked as a duplicate of 12552 ***