[LLVMbugs] [Bug 8511] New: likely x86 miscompile using clang

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Oct 29 15:29:24 PDT 2010


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: unassignedbugs at nondot.org
        ReportedBy: regehr at cs.utah.edu
                CC: llvmbugs at cs.uiuc.edu


[regehr at 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;
} 

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

[regehr at n1 ~]$ clang -v

clang version 2.9 (trunk 117638)
Target: i386-pc-linux-gnu
Thread model: posix
[regehr at 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.



More information about the llvm-bugs mailing list