The assertion was off by one.  I tweaked some comments
while I was there.

Ciao,

Duncan.
Index: gcc.llvm/gcc/llvm-types.cpp
===================================================================
--- gcc.llvm.orig/gcc/llvm-types.cpp	2007-04-12 20:00:58.000000000 +0200
+++ gcc.llvm/gcc/llvm-types.cpp	2007-04-12 20:13:52.000000000 +0200
@@ -1256,14 +1256,12 @@
   unsigned StartOffsetInBits = getFieldOffsetInBits(Field);
   unsigned EndBitOffset    = FieldSizeInBits+StartOffsetInBits;
   
-  // If  the last inserted LLVM field completely contains this bitfield, just
+  // If the last inserted LLVM field completely contains this bitfield, just
   // ignore this field.
   if (!Info.Elements.empty()) {
-    // If the last field does not completely contain *this* bitfield, extend
-    // it.
     unsigned LastFieldBitOffset = Info.ElementOffsetInBytes.back()*8;
     unsigned LastFieldBitSize   = Info.ElementSizeInBytes.back()*8;
-    assert(LastFieldBitOffset < StartOffsetInBits &&
+    assert(LastFieldBitOffset <= StartOffsetInBits &&
            "This bitfield isn't part of the last field!");
     if (EndBitOffset <= LastFieldBitOffset+LastFieldBitSize &&
         LastFieldBitOffset+LastFieldBitSize >= StartOffsetInBits) {
Index: llvm.master/test/CFrontend/2007-03-26-BitfieldAfterZeroWidth.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ llvm.master/test/CFrontend/2007-03-26-BitfieldAfterZeroWidth.c	2007-04-12 15:49:04.000000000 +0200
@@ -0,0 +1,6 @@
+// RUN: %llvmgcc %s -S -o -
+struct W {};
+struct Y {
+  struct W w;
+  int i:1;
+} __attribute__ ((packed)) y;
_______________________________________________
llvm-commits mailing list
[EMAIL PROTECTED]
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to