First Last Prev Next    No search results available
Details
: Oversized integer bitfields
Bug#: 6
: tools
: llvm-gcc
Status: RESOLVED
Resolution: FIXED
: All
: All
: 1.0
: P2
: normal
: 1.1

:
: compile-fail
:
:
  Show dependency tree - Show dependency graph
People
Reporter: Chris Lattner <sabre@nondot.org>
Assigned To: Chris Lattner <sabre@nondot.org>
:

Attachments


Note

You need to log in before you can comment on or make changes to this bug.

Related actions


Description:   Opened: 2003-10-07 14:07
Bug: llvm/test/Regression/CFrontend/2003-08-30-LargeIntegerBitfieldMember.c

Causes crash:
$ llvmgcc -c 2003-08-30-LargeIntegerBitfieldMember.c
UNKNOWN INTEGRAL TYPE SIZE: 984
2003-08-30-LargeIntegerBitfieldMember.c:9: internal compiler error: in
llvm_type_get_integer, at llvm-types.c:489
------- Comment #1 From Misha Brukman 2003-11-13 17:37:55 -------
This bug prevents pine from compiling as "struct pine { ... }" contains
something resembling this test case as a subset.

Since this prevents Chris from using LLVM-pine, I'm escalating the bug to
"major". :)
------- Comment #2 From Chris Lattner 2003-11-13 17:49:54 -------
Dood, in that case, this has got to be fixed by 1.1!!
------- Comment #3 From Chris Lattner 2003-11-19 19:02:25 -------
(finally) Fixed.  Testcase: CFrontend/2003-08-30-LargeIntegerBitfieldMember.c

Patch:

$ diff -u llvm-types.c~ llvm-types.c
--- llvm-types.c~       2003-11-19 18:17:19.000000000 -0600
+++ llvm-types.c        2003-11-19 18:59:34.000000000 -0600
@@ -711,6 +711,23 @@
           *Size = 0;
       } while (*Idx && *Size > StartByte);
 
+      /* Output this as a series of integer fields. */
+      while (ElSize > 64) {
+        unsigned UnitSize = ElSize & 63;
+        /* Eliminate all but one bit from the size */
+        if ((UnitSize & (UnitSize-1)) != 0)
+          UnitSize = UnitSize ^ (UnitSize & (UnitSize-1));
+
+        if (UnitSize == 0) UnitSize = 64;
+
+        ElementTys[*Idx] = llvm_type_get_integer(UnitSize, 1);
+        ElementOffsets[*Idx] = StartByte;
+        ElementAlignments[*Idx] = 1;
+        ++*Idx;
+        StartByte += UnitSize/8;
+        ElSize -= UnitSize;
+      }
+
       Ty = llvm_type_get_integer(ElSize, !HasSignedField);
     }
 
-Chris

First Last Prev Next    No search results available