Bugzilla – Bug 143
[llvm-gcc] Illegal union field reference
Last modified: 2003-11-20 14:58:28
You need to log in before you can comment on or make changes to this bug.
Reduced from xemacs-21.5.14: % cat doprnt.i struct printf_spec { unsigned int minus_flag:1; char converter; }; void parse_doprnt_spec () { struct printf_spec spec; spec.minus_flag = 1; } % llvm-gcc doprnt.i cc1: ../../gcc-3.4/gcc/llvm-expand.c:4659: llvm_expand_lvalue_expr: Assertion `(ActualSize & 7) == 0 && (Size & 7) == 0 && "Illegal union field reference!"' failed. doprnt.i: In function `parse_doprnt_spec': doprnt.i:9: internal compiler error: Aborted Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://llvm.cs.uiuc.edu> for instructions.
Fixed. Testcase: CFrontend/2003-11-20-UnionBitfield.c Patch: $ diff -u llvm-expand.c~ llvm-expand.c --- llvm-expand.c~ 2003-11-20 13:38:23.000000000 -0600 +++ llvm-expand.c 2003-11-20 14:54:50.000000000 -0600 @@ -4655,8 +4655,6 @@ * pointer to the desired type now. */ if (ActualOffset == Offset && ResultElTy != FieldDeclTy) { - assert((ActualSize & 7) == 0 && (Size & 7) == 0 && - "Illegal union field reference!"); Result = cast_if_type_not_equal(Fn, Op0, llvm_type_get_pointer(FieldDeclTy)); ResultElTy = GET_POINTER_TYPE_ELEMENT(Result->Ty); -Chris