This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/11751] wrong evaluation order of an expression
- From: "oraytman1 at comcast dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 16 Jun 2017 21:22:59 +0000
- Subject: [Bug c/11751] wrong evaluation order of an expression
- Auto-submitted: auto-generated
- References: <bug-11751-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11751
--- Comment #89 from Oleg <oraytman1 at comcast dot net> ---
Is this produces correct output?
#include <cstring>
#include <cstdio>
int main()
{
int i = 100;
i = i++ + ++i;
printf("i=%d\n", i);
i = 100;
i = ++i + i++;
printf("i=%d\n", i);
i = 100;
i = i + i++;
printf("i=%d\n", i);
return 0;
}
output:
i=202
i=203