[LLVMbugs] [Bug 155] NEW: [llvm-gcc] crash on union initialization

bugzilla-daemon at zion.cs.uiuc.edu bugzilla-daemon at zion.cs.uiuc.edu
Tue Nov 25 12:23:08 PST 2003


http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=155

           Summary: [llvm-gcc] crash on union initialization
           Product: tools
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: llvm-gcc
        AssignedTo: sabre at nondot.org
        ReportedBy: brukman+bugs at uiuc.edu


This happens to occur in the Linux kernel... linux/arch/i386/kernel/init_task.c
to be more precise.

% cat it.i
struct list_head {
 struct list_head *next, *prev;
};
struct task_struct {
 int filler;
 struct list_head thread_group;
};
union task_union {
 struct task_struct task;
 unsigned long stack[2048*sizeof(long)/sizeof(long)];
};

union task_union init_task_union = { {
thread_group: { &(init_task_union.task.thread_group), 0 }, } };
% llvm-gcc it.i
ERROR: In function llvm_expand_constant_expr:4488, tree not handled by LLVM yet!
 <non_lvalue_expr 0x402480dc
    type <pointer_type 0x40247310
        type <record_type 0x40246d90 task_struct type_0 BLK
            size <integer_cst 0x40242c30 constant 96>
            unit size <integer_cst 0x400246b8 constant 12>
            align 32 symtab 0 alias set -1 fields <field_decl 0x40246e70 filler>
context <translation_unit_decl 0x4001d070>
            pointer_to_this <pointer_type 0x40247310> chain <type_decl 0x40246e00>>
        unsigned SI
        size <integer_cst 0x4001b7d0 constant 32>
        unit size <integer_cst 0x4001b7f8 constant 4>
        align 32 symtab 0 alias set -1>
    constant
    arg 0 <nop_expr 0x402480c8 type <pointer_type 0x40247310>
        constant
        arg 0 <addr_expr 0x40248078 type <pointer_type 0x40247380>
            constant arg 0 <var_decl 0x402472a0 init_task_union>>>>
it.i:14: internal compiler error: in llvm_expand_constant_expr, at
llvm-expand.c:4488
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://llvm.cs.uiuc.edu> for instructions.


Furthermore, if we remove "int filler" from the struct above, the error we get
is different:

cc1: ../../gcc-3.4/gcc/llvm-expand.c:144: cast_if_type_not_equal: Assertion
`((V->Ty)->ID == PointerTyID || ((V->Ty->ID < FunctionTyID) && (V->Ty)->ID !=
VoidTyID)) &&"Cannot cast from non-first-class type!"' failed.
it.i:13: internal compiler error: Aborted
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://llvm.cs.uiuc.edu> for instructions.

GCC 3.3 seems to chew through this code without a problem.



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