[llvm-commits] [llvm-gcc-4.2] r45844 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
Dale Johannesen
dalej at apple.com
Thu Jan 10 15:38:45 PST 2008
Author: johannes
Date: Thu Jan 10 17:38:45 2008
New Revision: 45844
URL: http://llvm.org/viewvc/llvm-project?rev=45844&view=rev
Log:
Prevent crashes on 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=45844&r1=45843&r2=45844&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Thu Jan 10 17:38:45 2008
@@ -800,6 +800,11 @@
/// reset_initializer_llvm - Change the initializer for a global variable.
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))
+ return;
+
// Get or create the global variable now.
GlobalVariable *GV = cast<GlobalVariable>(DECL_LLVM(decl));
More information about the llvm-commits
mailing list