User account creation filtered due to spam.

Bug 16887

Summary: Bad assignment in "int i=1; i=i++;"
Product: gcc Reporter: Kristoffer Sokolowski <krs>
Component: cAssignee: Not yet assigned to anyone <unassigned>
Severity: normal CC: gcc-bugs
Priority: P2    
Version: 3.4.1   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:

Description Kristoffer Sokolowski 2004-08-05 14:09:54 UTC
gcc -v:
Reading specs from /opt/GCC341/lib/gcc/sparc-sun-solaris2.6/3.4.1/specs
Configured with: ../gcc-3.4.1/configure --prefix=/opt/GCC341 --with-as=/usr/ccs/bin/as --with-
ld=/usr/ccs/bin/ld --disable-libgcj --enable-languages=c,c++,objc
Thread model: posix
gcc version 3.4.1

uname -srv:
SunOS 5.6 Generic_105181-11

The not normally used expression:
 int i=1; 
will yield i==1, but should yield i==2. 
This does not occur in GCC v.2.8.1 nor in Microsoft VC++. 
Could be a problem in another assignment situations
Comment 1 Richard Earnshaw 2004-08-05 14:21:02 UTC
Not a bug.  Think sequence points...
Comment 2 Kristoffer Sokolowski 2004-08-05 14:41:20 UTC
(In reply to comment #1)
> Not a bug.  Think sequence points...
I'm not sure what you mean by that, but
I still think it is a bug, because operator ++ has higher precedence 
over =.
Comment 3 Wolfgang Bangerth 2004-08-05 14:54:42 UTC
No, it's not a bug. You can't modify a variable twice in one 
expression. That's what you're trying to do, though, with the ++ 
and the assignment. 
Take a look at any of PR 11363, PR 11751, PR 12552, PR 13403,  
PR 14417, PR 15012, PR 15103. 
Comment 4 Wolfgang Bangerth 2004-08-13 15:45:23 UTC
Reopen to mark as a duplicate of... 
Comment 5 Wolfgang Bangerth 2004-08-13 15:46:07 UTC
...PR 11751. 

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