public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: matthieu.moy@ensimag.imag.fr
To: gcc-gnats@gcc.gnu.org
Subject: c/2600: gcc fails to increment a signed int variable by one with -O2
Date: Fri, 20 Apr 2001 07:26:00 -0000	[thread overview]
Message-ID: <20010420142241.17758.qmail@sourceware.cygnus.com> (raw)

>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=


                 reply	other threads:[~2001-04-20  7:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010420142241.17758.qmail@sourceware.cygnus.com \
    --to=matthieu.moy@ensimag.imag.fr \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).