[LLVMbugs] [Bug 323] NEW: llvm-gcc crashes on union with bitfield

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Apr 20 08:02:49 PDT 2004


           Summary: llvm-gcc crashes on union with bitfield
           Product: tools
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: llvm-gcc
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: criswell at uiuc.edu

The following code crashes llvm-gcc:

struct dvd_send_key {
 unsigned agid : 2;
 unsigned char key[5];

typedef union {
 struct dvd_send_key lsk;
} dvd_authinfo;

dvd_authinfo * ai;

I've done some digging, and what I've found is kinda neat:

llvm-gcc uses llvm_type_get_size() to determine what LLVM type to use for a
field of x bits.  Well, in this case, it is not considering the array of 5 bytes
in dvd_send_key as an array; instead, it is asking llvm_type_get_size() for an
LLVM type of 40 (5*8) bits.  If you change it to 4, the code works (8*4=32)
bits, an integer.

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

More information about the llvm-bugs mailing list