Prevent crashes on erroneous input.

llvm-svn: 45844
diff --git a/llvm-gcc-4.2/gcc/llvm-backend.cpp b/llvm-gcc-4.2/gcc/llvm-backend.cpp
index efd0aa8..9de89a0 100644
--- a/llvm-gcc-4.2/gcc/llvm-backend.cpp
+++ b/llvm-gcc-4.2/gcc/llvm-backend.cpp
@@ -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));