[llvm-commits] CVS: llvm-gcc/gcc/llvm-types.c
Chris Lattner
lattner at cs.uiuc.edu
Sat Dec 4 13:45:09 PST 2004
Changes in directory llvm-gcc/gcc:
llvm-types.c updated: 1.19 -> 1.20
---
Log message:
Finish fixing CFrontend/2004-11-27-VariableSizeInStructure.c
---
Diffs of the changes: (+7 -4)
Index: llvm-gcc/gcc/llvm-types.c
diff -u llvm-gcc/gcc/llvm-types.c:1.19 llvm-gcc/gcc/llvm-types.c:1.20
--- llvm-gcc/gcc/llvm-types.c:1.19 Tue Nov 30 13:15:44 2004
+++ llvm-gcc/gcc/llvm-types.c Sat Dec 4 15:44:55 2004
@@ -618,15 +618,18 @@
*/
static unsigned GetFieldOffset(tree Field) {
assert(DECL_FIELD_BIT_OFFSET(Field) != 0 && DECL_FIELD_OFFSET(Field) != 0);
- return TREE_INT_CST_LOW(DECL_FIELD_BIT_OFFSET(Field)) +
- TREE_INT_CST_LOW(DECL_FIELD_OFFSET(Field))*8;
+ unsigned Result = TREE_INT_CST_LOW(DECL_FIELD_BIT_OFFSET(Field));
+ if (TREE_CODE(DECL_FIELD_OFFSET(Field)) == INTEGER_CST)
+ Result += TREE_INT_CST_LOW(DECL_FIELD_OFFSET(Field))*8;
+ return Result;
}
/* GetDeclSize - Return the size of the declaration, in bits. */
static unsigned GetDeclSize(tree Field) {
- if (DECL_SIZE(Field))
+ if (DECL_SIZE(Field) && TREE_CODE(DECL_SIZE(Field)) == INTEGER_CST)
return TREE_INT_CST_LOW(DECL_SIZE(Field));
- else if (TYPE_SIZE(TREE_TYPE(Field)))
+ else if (TYPE_SIZE(TREE_TYPE(Field)) &&
+ TREE_CODE(TYPE_SIZE(TREE_TYPE(Field))) == INTEGER_CST)
return TREE_INT_CST_LOW(TYPE_SIZE(TREE_TYPE(Field)));
else
return 0; /* Must be something like a "flexible array" member in a struct */
More information about the llvm-commits
mailing list