[llvm-commits] [llvm-gcc-4.2] r42187 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp

Duncan Sands baldrick at free.fr
Fri Sep 21 07:30:12 PDT 2007


Author: baldrick
Date: Fri Sep 21 09:30:11 2007
New Revision: 42187

URL: http://llvm.org/viewvc/llvm-project?rev=42187&view=rev
Log:
If TYPE_SIZE is null (in which case we almost certainly
never get here), then bail out conservatively rather than
optimistically.  Likewise if TYPE_SIZE is negative.

Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-types.cpp

Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=42187&r1=42186&r2=42187&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Fri Sep 21 09:30:11 2007
@@ -547,13 +547,14 @@
   // If the type does not overlap, don't bother checking below.
 
   if (!TYPE_SIZE(type))
-    return false;
+    // C-style variable length array?  Be conservative.
+    return true;
 
-  if (!isInt64(TYPE_SIZE(type), false))
-    // Variable sized or huge - be conservative.
+  if (!isInt64(TYPE_SIZE(type), true))
+    // Negative size (!) or huge - be conservative.
     return true;
 
-  if (!getInt64(TYPE_SIZE(type), false) ||
+  if (!getInt64(TYPE_SIZE(type), true) ||
       PadStartBits >= (int64_t)getInt64(TYPE_SIZE(type), false) ||
       PadStartBits+PadSizeBits <= 0)
     return false;





More information about the llvm-commits mailing list