[LLVMbugs] [Bug 2394] New: llvm-gcc generates wrong code for load from bitfield in packed struct

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sat May 31 06:02:05 PDT 2008


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

           Summary: llvm-gcc generates wrong code for load from bitfield in
                    packed struct
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sharparrow1 at yahoo.com
                CC: llvmbugs at cs.uiuc.edu


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