[llvm-commits] [125851] Fix bit field regression.
dpatel at apple.com
dpatel at apple.com
Fri Apr 6 20:05:10 PDT 2007
Revision: 125851
Author: dpatel
Date: 2007-04-06 20:05:09 -0700 (Fri, 06 Apr 2007)
Log Message:
-----------
Fix bit field regression. One llvm field, array of bytes,
can be used by two struct bitfields. In this situation
while iniitalizing smaller bitfield add empty elements
in extra bytes.
Modified Paths:
--------------
apple-local/branches/llvm/gcc/llvm-convert.cpp
Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp
===================================================================
--- apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-04-07 02:43:09 UTC (rev 125850)
+++ apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-04-07 03:05:09 UTC (rev 125851)
@@ -5362,7 +5362,13 @@
OffsetToBitFieldStart = 0;
NumBitsToInsert -= NumEltBitsToInsert;
}
-
+
+ // Pad extra array elements. This may happens when one llvm field
+ // is used to access two struct fields and llvm field is represented
+ // as an array of bytes.
+ for (; i < Elts.size(); ++i)
+ Elts[i] = ConstantInt::get((cast<ArrayType>(FieldTy))->getElementType(), 0);
+
return ConstantArray::get(cast<ArrayType>(FieldTy), Elts);
}
}
More information about the llvm-commits
mailing list