User account creation filtered due to spam.

Bug 12569 - Incorrect result on pathological code
Summary: Incorrect result on pathological code
Status: RESOLVED DUPLICATE of bug 12552
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 3.2.2
: P3 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2003-10-10 14:57 UTC by Zombywuf
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
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 

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