[llvm-commits] CVS: llvm-gcc/gcc/llvm-types.c

Chris Lattner lattner at cs.uiuc.edu
Tue Nov 30 11:15:58 PST 2004



Changes in directory llvm-gcc/gcc:

llvm-types.c updated: 1.18 -> 1.19
---
Log message:

Fix 2004-11-27-VariableSizeInStructure.c with checking enabled.


---
Diffs of the changes:  (+4 -1)

Index: llvm-gcc/gcc/llvm-types.c
diff -u llvm-gcc/gcc/llvm-types.c:1.18 llvm-gcc/gcc/llvm-types.c:1.19
--- llvm-gcc/gcc/llvm-types.c:1.18	Mon Nov 29 15:29:29 2004
+++ llvm-gcc/gcc/llvm-types.c	Tue Nov 30 13:15:44 2004
@@ -1272,8 +1272,11 @@
      * before calling llvm_type_get_from_tree, so we just allocate "enough"
      * space.
      */
+    Size = 0;
+    if (TREE_CODE(TYPE_SIZE(type)) == INTEGER_CST)
+      Size = TREE_INT_CST_LOW(TYPE_SIZE(type));
     Result = llvm_type_create_struct(1024 /*FIXME THIS IS HORRIBLE!*/,
-                                     (TREE_INT_CST_LOW(TYPE_SIZE(type))+7)/8);
+                                     (Size+7)/8);
     /* Add the new structure type to the hash table of created structure types.
      */
     HTE = *HTEP = xmalloc(sizeof(PtrPtrTableEntry)); /* Fill in the entry... */






More information about the llvm-commits mailing list