This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/18050] -Wsequence-point reports false positives
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Mar 2006 12:26:13 -0000
- Subject: [Bug c/18050] -Wsequence-point reports false positives
- References: <bug-18050-4370@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #7 from joseph at codesourcery dot com 2006-03-22 12:26 -------
Subject: Re: -Wsequence-point reports false positives
On Wed, 22 Mar 2006, rguenth at gcc dot gnu dot org wrote:
> i = ++i;
Modified twice between sequence points, so undefined behavior.
> I think the point is we should not warn for pre-increment, only post-increment.
> Or can someone come up with a testcase that has undefined evaluation order just
> by using pre-increment? One with two pre-increments:
It's undefined behavior, not undefined evaluation order. Pre-increment
returns the new value, but that doesn't mean the new value is stored until
the following sequence point.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18050