public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/12552] New: Problem with increment operator gcc/g++
@ 2003-10-09 16:27 devnull at frogshit dot com
2003-10-09 16:30 ` [Bug c/12552] " falk at debian dot org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: devnull at frogshit dot com @ 2003-10-09 16:27 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12552
Summary: Problem with increment operator gcc/g++
Product: gcc
Version: 3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: devnull at frogshit dot com
CC: gcc-bugs at gcc dot gnu dot org
% more price.c
#include <stdio.h>
int main()
{
int price = 10;
int cost = price++ + ++price;
printf("%d\n", cost);
return 0;
}
% gcc price.c
% ./a.out
21
% gcc -O price.c
% ./a.out
22
I reported this error once before, back in the 2.95 days, I think.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/12552] Problem with increment operator gcc/g++
2003-10-09 16:27 [Bug c/12552] New: Problem with increment operator gcc/g++ devnull at frogshit dot com
@ 2003-10-09 16:30 ` falk at debian dot org
2003-10-09 16:33 ` devnull at frogshit dot com
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: falk at debian dot org @ 2003-10-09 16:30 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12552
falk at debian dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
------- Additional Comments From falk at debian dot org 2003-10-09 16:30 -------
price is modified more than once without an intervening sequence point, so the
code is invalid.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/12552] Problem with increment operator gcc/g++
2003-10-09 16:27 [Bug c/12552] New: Problem with increment operator gcc/g++ devnull at frogshit dot com
2003-10-09 16:30 ` [Bug c/12552] " falk at debian dot org
@ 2003-10-09 16:33 ` devnull at frogshit dot com
2003-10-09 16:40 ` devnull at frogshit dot com
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: devnull at frogshit dot com @ 2003-10-09 16:33 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12552
------- Additional Comments From devnull at frogshit dot com 2003-10-09 16:33 -------
The answer should be 22. When I compile using gcc/g++, the
answer is 21. When I compile using gcc/g++ -O, the answer
is correct. I reported this bug once before.
Thanks!!
Mark
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/12552] Problem with increment operator gcc/g++
2003-10-09 16:27 [Bug c/12552] New: Problem with increment operator gcc/g++ devnull at frogshit dot com
2003-10-09 16:30 ` [Bug c/12552] " falk at debian dot org
2003-10-09 16:33 ` devnull at frogshit dot com
@ 2003-10-09 16:40 ` devnull at frogshit dot com
2003-10-09 16:43 ` falk at debian dot org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: devnull at frogshit dot com @ 2003-10-09 16:40 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12552
devnull at frogshit dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
------- Additional Comments From devnull at frogshit dot com 2003-10-09 16:40 -------
I don't know what invalid code means. The code is syntactically
correct, but one gets different semantics depending on whether
the compiler does or does not optimize. It seems reasonable
to expect the same output regardless of the level of optimization.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/12552] Problem with increment operator gcc/g++
2003-10-09 16:27 [Bug c/12552] New: Problem with increment operator gcc/g++ devnull at frogshit dot com
` (2 preceding siblings ...)
2003-10-09 16:40 ` devnull at frogshit dot com
@ 2003-10-09 16:43 ` falk at debian dot org
2003-10-10 15:20 ` schwab at suse dot de
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: falk at debian dot org @ 2003-10-09 16:43 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12552
falk at debian dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
------- Additional Comments From falk at debian dot org 2003-10-09 16:43 -------
The code has undefined behavior, which means that printing 21,
printing 22, printing 42, crashing, refusing to compile, and
formatting your hard disk would all be correct results. Please read
the documentation on -Wsequence-point and a good C book.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/12552] Problem with increment operator gcc/g++
2003-10-09 16:27 [Bug c/12552] New: Problem with increment operator gcc/g++ devnull at frogshit dot com
` (3 preceding siblings ...)
2003-10-09 16:43 ` falk at debian dot org
@ 2003-10-10 15:20 ` schwab at suse dot de
2004-08-05 14:57 ` bangerth at dealii dot org
2004-08-05 15:02 ` bangerth at dealii dot org
6 siblings, 0 replies; 8+ messages in thread
From: schwab at suse dot de @ 2003-10-10 15:20 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12552
schwab at suse dot de changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |s0094247 at sms dot ed dot
| |ac dot uk
------- Additional Comments From schwab at suse dot de 2003-10-10 15:20 -------
*** Bug 12569 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/12552] Problem with increment operator gcc/g++
2003-10-09 16:27 [Bug c/12552] New: Problem with increment operator gcc/g++ devnull at frogshit dot com
` (4 preceding siblings ...)
2003-10-10 15:20 ` schwab at suse dot de
@ 2004-08-05 14:57 ` bangerth at dealii dot org
2004-08-05 15:02 ` bangerth at dealii dot org
6 siblings, 0 replies; 8+ messages in thread
From: bangerth at dealii dot org @ 2004-08-05 14:57 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-08-05 14:57 -------
Reopen these bugs...
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12552
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/12552] Problem with increment operator gcc/g++
2003-10-09 16:27 [Bug c/12552] New: Problem with increment operator gcc/g++ devnull at frogshit dot com
` (5 preceding siblings ...)
2004-08-05 14:57 ` bangerth at dealii dot org
@ 2004-08-05 15:02 ` bangerth at dealii dot org
6 siblings, 0 replies; 8+ messages in thread
From: bangerth at dealii dot org @ 2004-08-05 15:02 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-08-05 15:02 -------
...mark as duplicate of 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=12552
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2004-08-05 15:02 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-09 16:27 [Bug c/12552] New: Problem with increment operator gcc/g++ devnull at frogshit dot com
2003-10-09 16:30 ` [Bug c/12552] " falk at debian dot org
2003-10-09 16:33 ` devnull at frogshit dot com
2003-10-09 16:40 ` devnull at frogshit dot com
2003-10-09 16:43 ` falk at debian dot org
2003-10-10 15:20 ` schwab at suse dot de
2004-08-05 14:57 ` bangerth at dealii dot org
2004-08-05 15:02 ` 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).