http://llvm.org/bugs/show_bug.cgi?id=8511

           Summary: likely x86 miscompile using clang
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


[reg...@n1 ~]$ cat foo.c

struct S1 {
   signed f1 : 22;
   signed f2 : 6;
};

struct S1 g_34 = {1,0};

extern int printf(const char *format, ...);

void func_85(struct S1  p_86)
{
    g_34.f2 ^= p_86.f2;
}

int  main(void)
{
    struct S1 l_438 = {-1,0};
    func_85(l_438);
    printf("g_34.f1 = %d\n", g_34.f1);
    return 0;
} 

[reg...@n1 ~]$ clang -O0 foo.c -o foo
[reg...@n1 ~]$ ./foo
g_34.f1 = 1
[reg...@n1 ~]$ clang -O1 foo.c -o foo
[reg...@n1 ~]$ ./foo
g_34.f1 = -1

[reg...@n1 ~]$ clang -v

clang version 2.9 (trunk 117638)
Target: i386-pc-linux-gnu
Thread model: posix
[reg...@n1 ~]$

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to