public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/16887] New: Bad assignment in "int i=1; i=i++;"
@ 2004-08-05 14:10 krs at home dot se
2004-08-05 14:19 ` [Bug c/16887] " krs at home dot se
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: krs at home dot se @ 2004-08-05 14:10 UTC (permalink / raw)
To: gcc-bugs
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
Comments:
The not normally used expression:
int i=1;
i=i++;
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
--
Summary: Bad assignment in "int i=1; i=i++;"
Product: gcc
Version: 3.4.1
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: krs at home dot se
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16887
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/16887] Bad assignment in "int i=1; i=i++;"
2004-08-05 14:10 [Bug c/16887] New: Bad assignment in "int i=1; i=i++;" krs at home dot se
@ 2004-08-05 14:19 ` krs at home dot se
2004-08-05 14:21 ` rearnsha at gcc dot gnu dot org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: krs at home dot se @ 2004-08-05 14:19 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|minor |normal
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16887
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/16887] Bad assignment in "int i=1; i=i++;"
2004-08-05 14:10 [Bug c/16887] New: Bad assignment in "int i=1; i=i++;" krs at home dot se
2004-08-05 14:19 ` [Bug c/16887] " krs at home dot se
@ 2004-08-05 14:21 ` rearnsha at gcc dot gnu dot org
2004-08-05 14:41 ` krs at home dot se
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rearnsha at gcc dot gnu dot org @ 2004-08-05 14:21 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rearnsha at gcc dot gnu dot org 2004-08-05 14:21 -------
Not a bug. Think sequence points...
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16887
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/16887] Bad assignment in "int i=1; i=i++;"
2004-08-05 14:10 [Bug c/16887] New: Bad assignment in "int i=1; i=i++;" krs at home dot se
2004-08-05 14:19 ` [Bug c/16887] " krs at home dot se
2004-08-05 14:21 ` rearnsha at gcc dot gnu dot org
@ 2004-08-05 14:41 ` krs at home dot se
2004-08-05 14:54 ` bangerth at dealii dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: krs at home dot se @ 2004-08-05 14:41 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From krs at home dot se 2004-08-05 14:41 -------
(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 =.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16887
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/16887] Bad assignment in "int i=1; i=i++;"
2004-08-05 14:10 [Bug c/16887] New: Bad assignment in "int i=1; i=i++;" krs at home dot se
` (2 preceding siblings ...)
2004-08-05 14:41 ` krs at home dot se
@ 2004-08-05 14:54 ` bangerth at dealii dot org
2004-08-13 15:45 ` bangerth at dealii dot org
2004-08-13 15:46 ` bangerth at dealii dot org
5 siblings, 0 replies; 7+ messages in thread
From: bangerth at dealii dot org @ 2004-08-05 14:54 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-08-05 14:54 -------
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.
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16887
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/16887] Bad assignment in "int i=1; i=i++;"
2004-08-05 14:10 [Bug c/16887] New: Bad assignment in "int i=1; i=i++;" krs at home dot se
` (3 preceding siblings ...)
2004-08-05 14:54 ` bangerth at dealii dot org
@ 2004-08-13 15:45 ` bangerth at dealii dot org
2004-08-13 15:46 ` bangerth at dealii dot org
5 siblings, 0 replies; 7+ messages in thread
From: bangerth at dealii dot org @ 2004-08-13 15:45 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-08-13 15:45 -------
Reopen to mark as a duplicate of...
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16887
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/16887] Bad assignment in "int i=1; i=i++;"
2004-08-05 14:10 [Bug c/16887] New: Bad assignment in "int i=1; i=i++;" krs at home dot se
` (4 preceding siblings ...)
2004-08-13 15:45 ` bangerth at dealii dot org
@ 2004-08-13 15:46 ` bangerth at dealii dot org
5 siblings, 0 replies; 7+ messages in thread
From: bangerth at dealii dot org @ 2004-08-13 15:46 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-08-13 15:46 -------
...PR 11751.
*** This bug has been marked as a duplicate of 11751 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16887
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2004-08-13 15:46 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-05 14:10 [Bug c/16887] New: Bad assignment in "int i=1; i=i++;" krs at home dot se
2004-08-05 14:19 ` [Bug c/16887] " krs at home dot se
2004-08-05 14:21 ` rearnsha at gcc dot gnu dot org
2004-08-05 14:41 ` krs at home dot se
2004-08-05 14:54 ` bangerth at dealii dot org
2004-08-13 15:45 ` bangerth at dealii dot org
2004-08-13 15:46 ` bangerth at dealii dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).