public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: Neil Booth <neil@daikokuya.co.uk> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, Subject: Re: c/10143: Post increment doesn work more than once per statement Date: Thu, 20 Mar 2003 00:16:00 -0000 [thread overview] Message-ID: <20030320001600.22348.qmail@sources.redhat.com> (raw) The following reply was made to PR c/10143; it has been noted by GNATS. From: Neil Booth <neil@daikokuya.co.uk> To: Nick Macdonald <macdonn@nortelnetworks.com> Cc: "Joseph S. Myers" <jsm28@cam.ac.uk>, Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>, gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org Subject: Re: c/10143: Post increment doesn work more than once per statement Date: Thu, 20 Mar 2003 00:08:04 +0000 Nick Macdonald wrote:- > I was just trying to make the product better... I feel the answer of > "not a bug" to be a bit pedantic... sure, technically it may not be a > bug... however, logically, the current behaviour is less than stellar > and it should be addressed to make post and pre increment behave more or > less similarly... I have learned a valuable lesson from all this, and I Things aren't that clearcut - effectively, the compiler passes the code to the optimizer with a set of restrictions indicating what the optimizer can and cannot assume. Because of guarantees afforded by the standard, the optimizer is given pretty free reign, and munges your code. But that's only because it's wrong. It's not a matter of treating a or b consistently; just consider it a fluke that you observed the result you did. If you move a line of code you might see a different result, or GCC in 2 months time might, for any of a million reasons, decide to optimize it differently. Now, -Wsequence-point should have warned, but its algorithm is based on GCC trees, so consider me unsurprised at its fragility. None of this existed in 2.95, but it does in 3.2. Neil.
next reply other threads:[~2003-03-20 0:16 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-03-20 0:16 Neil Booth [this message] -- strict thread matches above, loose matches on Subject: below -- 2003-03-19 22:36 Nick Macdonald 2003-03-19 20:16 Joseph S. Myers 2003-03-19 19:56 Nick Macdonald 2003-03-19 19:06 Joseph S. Myers 2003-03-19 14:26 Falk Hueffner 2003-03-19 14:06 Nick Macdonald 2003-03-19 7:10 neil 2003-03-19 1:06 macdonn
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=20030320001600.22348.qmail@sources.redhat.com \ --to=neil@daikokuya.co.uk \ --cc=gcc-prs@gcc.gnu.org \ --cc=nobody@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).