[llvm-branch-commits] [llvm-gcc-branch] r103152 - /llvm-gcc-4.2/branches/Apple/Morbo/gcc/llvm-convert.cpp
Stuart Hastings
stuart at apple.com
Wed May 5 18:10:24 PDT 2010
Author: stuart
Date: Wed May 5 20:10:24 2010
New Revision: 103152
URL: http://llvm.org/viewvc/llvm-project?rev=103152&view=rev
Log:
Handle variably-sized structs correctly. Followup to r102979. Thank you to Devang.
Modified:
llvm-gcc-4.2/branches/Apple/Morbo/gcc/llvm-convert.cpp
Modified: llvm-gcc-4.2/branches/Apple/Morbo/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Morbo/gcc/llvm-convert.cpp?rev=103152&r1=103151&r2=103152&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Morbo/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/branches/Apple/Morbo/gcc/llvm-convert.cpp Wed May 5 20:10:24 2010
@@ -7177,7 +7177,10 @@
// the slow-but-conservative-and-always-correct path.
tree gccContext = DECL_FIELD_CONTEXT(FieldDecl);
tree gccSize = TYPE_SIZE(gccContext);
- unsigned int gccStructSize = TREE_INT_CST_LOW(gccSize);
+ // If the size isn't constant, assume the worst (a one byte
+ // struct).
+ unsigned int gccStructSize = TREE_CODE(gccSize) == INTEGER_CST ?
+ TREE_INT_CST_LOW(gccSize) : 1;
// piecemeal == true means we fetch the bitfield in pieces and
// reassemble in a register.
bool piecemeal = false;
More information about the llvm-branch-commits
mailing list