[cfe-commits] r54395 - in /cfe/trunk: lib/CodeGen/CGExpr.cpp test/CodeGen/2008-07-22-packed-bitfield-access.c
Eli Friedman
eli.friedman at gmail.com
Sat Aug 9 16:21:52 PDT 2008
On Tue, Aug 5, 2008 at 10:08 PM, Daniel Dunbar <daniel at zuster.org> wrote:
> + // Fetch the high bits if necessary.
> + if (LowBits < BitfieldSize) {
> + unsigned HighBits = BitfieldSize - LowBits;
> + llvm::Value *HighPtr =
> + Builder.CreateGEP(Ptr, llvm::ConstantInt::get(llvm::Type::Int32Ty, 1),
> + "bf.ptr.hi");
> + llvm::Value *HighVal = Builder.CreateLoad(HighPtr,
> + LV.isVolatileQualified(),
> + "tmp");
This is incorrect; it assumes that the struct is sufficiently aligned
for the load to succeed. See
http://llvm.org/bugs/show_bug.cgi?id=2394 for a similar bug in
llvm-gcc.
-Eli
More information about the cfe-commits
mailing list