Bug 5494

Summary: ((++a)+(++a)) yeilds 4 on x86, but 3 on everything else.
Product: gcc Reporter: carpman
Component: c++Assignee: Not yet assigned to anyone <unassigned>
Severity: normal CC: gcc-bugs, ljrittle
Priority: P3    
Version: 2.95.2   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:

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 ***