This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/50142] New: There is bug when swap elements of an array via chain expression.
- From: "thomas.c.zhao at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 21 Aug 2011 11:06:24 +0000
- Subject: [Bug c/50142] New: There is bug when swap elements of an array via chain expression.
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50142
Bug #: 50142
Summary: There is bug when swap elements of an array via chain
expression.
Classification: Unclassified
Product: gcc
Version: 4.0.3
Status: UNCONFIRMED
Severity: critical
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: thomas.c.zhao@gmail.com
[gcc version]: 4.0.3
[system type]: sparc-sun-solaris2.10
[build options]: none
[source code]:
main()
{
int a[] = {1,2};
a[0] ^= a[1] ^= a[0] ^= a[1];
printf("a[0]=%d a[1]=%d\n", a[0], a[1]);
}
[expected result]: a[0]=2 a[1]=1
[actual result]: a[0]=0 a[1]=1
btw: gcc3 is ok.