[LLVMbugs] [Bug 6] Oversized integer bitfields

bugzilla-daemon at zion.cs.uiuc.edu bugzilla-daemon at zion.cs.uiuc.edu
Wed Nov 19 17:02:25 PST 2003


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

sabre at nondot.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |normal
             Status|ASSIGNED                    |RESOLVED
         OS/Version|Linux                       |All
           Platform|PC                          |All
         Resolution|                            |FIXED



------- Additional Comments From sabre at nondot.org  2003-11-19 19:02 -------
(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



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