c/2600: gcc fails to increment a signed int variable by one with -O2
matthieu.moy@ensimag.imag.fr
matthieu.moy@ensimag.imag.fr
Fri Apr 20 07:26:00 GMT 2001
>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=
More information about the Gcc-bugs
mailing list