public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c/2600: gcc fails to increment a signed int variable by one with -O2
@ 2001-04-20  7:26 matthieu.moy
  0 siblings, 0 replies; only message in thread
From: matthieu.moy @ 2001-04-20  7:26 UTC (permalink / raw)
  To: gcc-gnats

>Number:         2600
>Category:       c
>Synopsis:       gcc fails to increment a signed int variable by one with -O2
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 20 07:26:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Matthieu Moy
>Release:        gcc version 2.95.3
>Organization:
>Environment:
AIX on bull (8 procs)
>Description:
A variable plus one operation is not done if the program 
is compiled with optimisation -O2 in a very simple c program.

example of output :
$ gcc -O1 bug-gcc.c
$ a.out
i = 1; plus_one = 2
$ gcc -O2 bug-gcc.c
$ a.out
i = 1; plus_one = 1
>How-To-Repeat:
compile with -O1 and -O2
>Fix:
I didn't make any patch
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="bug-gcc.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="bug-gcc.c"

I2luY2x1ZGU8c3RkaW8uaD4KCnR5cGVkZWYgc2lnbmVkIGNoYXIgVDsKCmludCBtYWluKCkKewog
IFQgaSA9IDAsIHBsdXNfb25lOwogIGludCB5OwogIGZvcih5PTA7IHk8MTsgKyt5KQogICAgewog
ICAgICBpPWkrMTsKICAgICAgcHJpbnRmKCJpID0gJWQ7ICIsIGkpOwogICAgICBwbHVzX29uZSA9
IGkgKyAxOwogICAgICBwcmludGYoInBsdXNfb25lID0gJWRcbiIsIHBsdXNfb25lKTsKICAgIH0K
ICByZXR1cm4gMDsKfQo=


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-04-20  7:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-20  7:26 c/2600: gcc fails to increment a signed int variable by one with -O2 matthieu.moy

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).