[llvm-commits] [dragonegg] r95090 - /dragonegg/trunk/llvm-backend.cpp

Duncan Sands baldrick at free.fr
Tue Feb 2 06:51:02 PST 2010


Author: baldrick
Date: Tue Feb  2 08:51:01 2010
New Revision: 95090

URL: http://llvm.org/viewvc/llvm-project?rev=95090&view=rev
Log:
In some cases we may reuse an existing global variable here, in which
case it could in theory have an initial value already.

Modified:
    dragonegg/trunk/llvm-backend.cpp

Modified: dragonegg/trunk/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-backend.cpp?rev=95090&r1=95089&r2=95090&view=diff

==============================================================================
--- dragonegg/trunk/llvm-backend.cpp (original)
+++ dragonegg/trunk/llvm-backend.cpp Tue Feb  2 08:51:01 2010
@@ -1358,11 +1358,8 @@
     if (TREE_CODE(decl) == VAR_DECL && DECL_THREAD_LOCAL_P(decl))
       GV->setThreadLocal(true);
 
-    // At this point the global variable is a declaration rather than a
-    // definition, so it may have the wrong size (for example, the GCC
-    // type might have variable size, in which case the size will be set
-    // later by the initial value).  Do not check the size here.
-    assert(GV->isDeclaration() && "Global has unexpected initializer!");
+    assert((GV->isDeclaration() || SizeOfGlobalMatchesDecl(GV, decl)) &&
+           "Global has unexpected initializer!");
 
     return SET_DECL_LLVM(decl, GV);
   }





More information about the llvm-commits mailing list