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: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Mar 2006 12:19:43 -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 #6 from rguenth at gcc dot gnu dot org 2006-03-22 12:19 -------
Another one:
int foo(int i)
{
i = ++i;
return i;
}
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:
int foo(void)
{
int i = 1;
i = (++i == 2) + ++i;
return i;
}
This is certainly undefined. But with one pre-increment only?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18050