[LLVMbugs] [Bug 6176] New: clang generates wrong code for load from bitfield in packed struct

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Jan 29 13:57:56 PST 2010


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

           Summary: clang generates wrong code for load from bitfield in
                    packed struct
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: daniel at zuster.org
                CC: baldrick at free.fr, llvmbugs at cs.uiuc.edu


+++ This bug was initially created as a clone of Bug #2394 +++

struct __attribute((packed)) x {int a : 24;};
int a(struct x* g) {return g->a;}

Code generated with llvm-gcc:
a:
        movl    4(%esp), %eax
        movl    (%eax), %eax
        shll    $8, %eax
        sarl    $8, %eax
        ret

This is broken because the last byte might not be legal to load.


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