This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/47412] New: Output: x = 31 but y = 30
- From: "msarshadir at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 22 Jan 2011 14:02:29 +0000
- Subject: [Bug c++/47412] New: Output: x = 31 but y = 30
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47412
Summary: Output: x = 31 but y = 30
Product: gcc
Version: 4.4.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: msarshadir@gmail.com
#include <stdio.h>
int main() {
int x, y;
x = 10;
x = 20 + x++;
printf("x = %d\n", x);
x = 10;
y = 20 + x++;
printf("y = %d\n", y);
return 0;
}
Output of above program:
x = 31
y = 30
x have to be 30