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: unassig...@gcc.gnu.org ReportedBy: thomas.c.z...@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.