[LLVMbugs] [Bug 141] [llvm-gcc] Bitfields & large array don't mix well

bugzilla-daemon at zion.cs.uiuc.edu bugzilla-daemon at zion.cs.uiuc.edu
Thu Nov 20 11:07:43 PST 2003


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

sabre at nondot.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
            Summary|[llvm-gcc] crash assigning  |[llvm-gcc] Bitfields & large
                   |to an int of a struct       |array don't mix well
                   |containing bitfield & large |
                   |array                       |



------- Additional Comments From sabre at nondot.org  2003-11-20 13:07 -------
The second testcase below is fixed by this patch:

$ diff -u llvm-expand.c~ llvm-expand.c
--- llvm-expand.c~      2003-11-19 18:25:37.000000000 -0600
+++ llvm-expand.c       2003-11-20 12:59:12.000000000 -0600
@@ -4588,8 +4588,7 @@
     llvm_type *Op0Ty = llvm_type_get_from_tree(TREE_TYPE(TREE_OPERAND(exp, 0)));
 
     if (llvm_type_is_composite(Op0Ty)) {
-      llvm_value *Op0 = llvm_expand_lvalue_expr(Fn, TREE_OPERAND(exp, 0),
-                                                BitStart, BitSize);
+      llvm_value *Op0 = llvm_expand_lvalue_expr(Fn, TREE_OPERAND(exp, 0), 0, 0);
       llvm_value *Op1 = llvm_expand_expr(Fn, TREE_OPERAND(exp, 1), 0);
       Op1 = cast_if_type_not_equal(Fn, Op1, LongTy);
       Result = append_inst(Fn, create_gep3(Op0, llvm_constant_long_0, Op1));
@@ -4655,7 +4654,7 @@
       /* If this is accessing a union element, we can go ahead and cast the
        *  pointer to the desired type now.
        */
-      if (ActualOffset == Offset && Size > ActualSize) {
+      if (ActualOffset == Offset && ResultElTy != FieldDeclTy) {
         assert((ActualSize & 7) == 0 && (Size & 7) == 0 &&
                "Illegal union field reference!");
         Result = cast_if_type_not_equal(Fn, Op0,

... and is tested by CFrontend/2003-11-20-Bitfields.c

The first testcase in this patch is HELPED by this patch, but not fixed
completely.  The rest of the fix falls under the guise of Bug 82.

-Chris




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