User account creation filtered due to spam.

Bug 762

Summary: can not calculate x *=x++ correctly on GNU 2.8.1 in sparc-sun-solaris2.6 environment
Product: gcc Reporter: chuchunxin
Component: cAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED DUPLICATE    
Severity: normal CC: algorithmus, arminu, asokumar, bala, barnarr, bmead15, buergel, carpman, ceniza666, chuchunxin, devnull, d_picco, eric.mcvicker, gaurav_har, gcc-bugs, gcc, ggs, horsh, jandres, janis, krs, lid, lindahlb, lxg8906, mikaldaz, nakkore, neil, qyang, raoulgough, rglan, rjvbertin, robc, smartmouse714, suan, super.aorta, svetozarmarkov, tczarnecki, vanveghel, work, zshao
Priority: P3    
Version: unknown   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:

Description chuchunxin 2000-11-09 15:16:01 UTC
x = 2;
x *= x++;

what is the value of x? 

It should be 5, but in the workstation I can only get 3.

Release:
2.8.1

Environment:
sun solaris 2.6

How-To-Repeat:
Just do a calculation on the above expression
Comment 1 chuchunxin 2000-11-09 15:16:01 UTC
Fix:
Not a bug; it is undefined behaviour.
Comment 2 Neil Booth 2000-11-09 15:48:38 UTC
State-Changed-From-To: open->closed
State-Changed-Why: Not a bug; it is undefined behaviour.
    
    >> what is the value of x? 
    
    Exactly!  You might want to use x *= x or x = x * x + 1
    depending upon what you're trying to do.
Comment 3 Neil Booth 2000-11-09 23:48:38 UTC
From: neil@gcc.gnu.org
To: chuchunxin@hotmail.com, gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org,
  nobody@gcc.gnu.org
Cc:  
Subject: Re: c/762
Date: 9 Nov 2000 23:48:38 -0000

 Synopsis: can not calculate x *=x++ correctly on GNU 2.8.1 in sparc-sun-solaris2.6 environment
 
 State-Changed-From-To: open->closed
 State-Changed-By: neil
 State-Changed-When: Thu Nov  9 15:48:38 2000
 State-Changed-Why:
     Not a bug; it is undefined behaviour.
     
     >> what is the value of x? 
     
     Exactly!  You might want to use x *= x or x = x * x + 1
     depending upon what you're trying to do.
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=762&database=gcc
Comment 4 Andrew Pinski 2005-11-10 03:17:39 UTC
Reopening to ...
Comment 5 Andrew Pinski 2005-11-10 03:17:55 UTC
Mark as a dup of bug 11751.

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