[Bug c/27233] New: incorrect xor result on arrays

raphael dot ribas at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Apr 21 00:38:00 GMT 2006


the following code

#include <stdio.h>

int main() {
    int a[1],b[1];
    a[0]=5;
    b[0]=7;
    a[0]^=b[0]^=a[0]^=b[0];
    printf("%d %d\n",a[0],b[0]);
    return 0;
}

this should produce "7 5" as outpout but it produces "0 5"


-- 
           Summary: incorrect xor result on arrays
           Product: gcc
           Version: 4.0.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: raphael dot ribas at gmail dot com
 GCC build triplet:  ../src/configure -v --enable-
                    languages=c,c++,java,f95,objc,ada,
  GCC host triplet: x86 linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27233



More information about the Gcc-bugs mailing list