Bug 5494 - ((++a)+(++a)) yeilds 4 on x86, but 3 on everything else.
Summary: ((++a)+(++a)) yeilds 4 on x86, but 3 on everything else.
Status: RESOLVED DUPLICATE of bug 11751
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 2.95.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2002-01-25 11:36 UTC by carpman
Modified: 2005-04-20 02:57 UTC (History)
2 users (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 carpman 2002-01-25 11:36:00 UTC
this code..

void main(void){
 int a=0;

 cout << ((++a)+(++a)) << endl; 

will produce 4 on x86, but 3 on every other arch I can test.

gcc 2.95.2

MAC OS X and Debian Linux.
Comment 1 Loren Rittle 2002-01-25 16:00:59 UTC
State-Changed-From-To: open->closed
State-Changed-Why: Not a compiler bug.
    There are zero sequence points within this expression:
    In semi-layman's terms, prefix and postfix ++/-- may
    only be used once per object per pair of consecutive
    sequence points.
    If you don't know what a sequence point is, then please
    consult the C standard for more details...
Comment 2 Andrew Pinski 2005-04-20 02:57:06 UTC
Reopening to ...
Comment 3 Andrew Pinski 2005-04-20 02:57:21 UTC
Mark as a dup of bug 11751.

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