public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: Pierre.van.de.Laar_AT_Philips.com@sources.redhat.com To: gcc-gnats@gcc.gnu.org Subject: optimization/8175: different behaviour with different optimization levels Date: Wed, 09 Oct 2002 08:36:00 -0000 [thread overview] Message-ID: <20021009153053.23458.qmail@sources.redhat.com> (raw) >Number: 8175 >Category: optimization >Synopsis: different behaviour with different optimization levels >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Wed Oct 09 08:36:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Pierre.van.de.Laar_AT_Philips.com >Release: gcc version 2.95.3 20010315 (release) >Organization: >Environment: unix >Description: The following (stupid, I admit) code is treated differently under different optimalizations (no warning or error is made) #include <stdio.h> int main(int argc, char * argv[]) { int i; /* use argc */ i = argc; if (i++ == i++) { printf("true %d\n",i); } else { printf("false %d\n",i); } return 0; } laarp@mollis [199] > gcc -Wall -O0 test.c laarp@mollis [200] > a.out true 2 laarp@mollis [201] > gcc -Wall -O6 test.c laarp@mollis [202] > a.out false 3 Note: This piece of code violates: an object shall have its stored value modified at most once by the evaluation of an expression (Committee Draft -- August 3, 1998, WG14/N843 paragraph 6.5 Expressions) I don't know if it is still part of the the official release. >How-To-Repeat: Just compile the code and see for yourself! >Fix: Generate at least a warning or always have the same behaviour. >Release-Note: >Audit-Trail: >Unformatted:
next reply other threads:[~2002-10-09 15:36 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-10-09 8:36 Pierre.van.de.Laar_AT_Philips.com [this message] 2002-10-11 16:19 rth
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=20021009153053.23458.qmail@sources.redhat.com \ --to=pierre.van.de.laar_at_philips.com@sources.redhat.com \ --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: linkBe 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).