[LLVMbugs] [Bug 2001] New: clang bitfield assignment produces wrong value

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sat Feb 9 02:04:24 PST 2008


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

           Summary: clang bitfield assignment produces wrong value
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: LLVM Codegen
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sharparrow1 at yahoo.com
                CC: llvmbugs at cs.uiuc.edu


int a(int x) {
struct {signed int x:5;} s;
return s.x = x;
}

clang -emit-llvm-bc | opt -std-compile-opts reduces this to "ret i32 %x", which
is wrong; the result should be something more like what llvm-gcc produces:

define i32 @a(i32 %x) {
entry:
        %tmp14 = shl i32 %x, 27
        %tmp15 = ashr i32 %tmp14, 27
        %tmp1516 = trunc i32 %tmp15 to i8
        %tmp151617 = sext i8 %tmp1516 to i32
        ret i32 %tmp151617
}

(Actually, ideally it would be smart enough to figure out that the trunc+sext
don't do anything, but that's a separate issue.)


-- 
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