[llvm-commits] [llvm-gcc-4.2] r50270 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp

Dale Johannesen dalej at apple.com
Fri Apr 25 10:39:45 PDT 2008


Author: johannes
Date: Fri Apr 25 12:39:45 2008
New Revision: 50270

URL: http://llvm.org/viewvc/llvm-project?rev=50270&view=rev
Log:
Prevent crashing in some cases of erroneous input.


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

Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=50270&r1=50269&r2=50270&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Fri Apr 25 12:39:45 2008
@@ -858,7 +858,9 @@
 void reset_initializer_llvm(tree decl) {
   // If there were earlier errors we can get here when DECL_LLVM has not
   // been set.  Don't crash.
-  if ((errorcount || sorrycount) && !DECL_LLVM(decl))
+  // We can also get here when DECL_LLVM has not been set for some object
+  // referenced in the initializer.  Don't crash then either.
+  if (errorcount || sorrycount)
     return;
 
   // Get or create the global variable now.
@@ -876,7 +878,9 @@
 void reset_type_and_initializer_llvm(tree decl) {
   // If there were earlier errors we can get here when DECL_LLVM has not
   // been set.  Don't crash.
-  if ((errorcount || sorrycount) && !DECL_LLVM(decl))
+  // We can also get here when DECL_LLVM has not been set for some object
+  // referenced in the initializer.  Don't crash then either.
+  if (errorcount || sorrycount)
     return;
 
   // Get or create the global variable now.





More information about the llvm-commits mailing list