[llvm-commits] [dragonegg] r128529 - in /dragonegg/trunk: Backend.cpp Constants.cpp

Duncan Sands baldrick at free.fr
Tue Mar 29 23:30:55 PDT 2011


Author: baldrick
Date: Wed Mar 30 01:30:55 2011
New Revision: 128529

URL: http://llvm.org/viewvc/llvm-project?rev=128529&view=rev
Log:
Remove checks that initializers are constant (TREE_CONSTANT) since they
are not really helpful and can be harmful.  They don't help much since
if the initializer really isn't constant then the constant conversion
logic will fail with an appropriate error anyway.  They are harmful since
some frontends, in particular the Fortran frontend when compiling Fortran
90 code, and the java frontend, forget to set TREE_CONSTANT sometimes on
constants, resulting in dragonegg barfing even though there is no real
problem.

Modified:
    dragonegg/trunk/Backend.cpp
    dragonegg/trunk/Constants.cpp

Modified: dragonegg/trunk/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/Backend.cpp?rev=128529&r1=128528&r2=128529&view=diff
==============================================================================
--- dragonegg/trunk/Backend.cpp (original)
+++ dragonegg/trunk/Backend.cpp Wed Mar 30 01:30:55 2011
@@ -1010,10 +1010,6 @@
     const Type *Ty = ConvertType(TREE_TYPE(decl));
     Init = getDefaultValue(Ty);
   } else {
-    assert((TREE_CONSTANT(DECL_INITIAL(decl)) ||
-            TREE_CODE(DECL_INITIAL(decl)) == STRING_CST) &&
-           "Global initializer should be constant!");
-
     // Temporarily set an initializer for the global, so we don't infinitely
     // recurse.  If we don't do this, we can hit cases where we see "oh a global
     // with an initializer hasn't been initialized yet, call emit_global on it".

Modified: dragonegg/trunk/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/Constants.cpp?rev=128529&r1=128528&r2=128529&view=diff
==============================================================================
--- dragonegg/trunk/Constants.cpp (original)
+++ dragonegg/trunk/Constants.cpp Wed Mar 30 01:30:55 2011
@@ -1063,8 +1063,6 @@
 /// that it has the same alloc size as the original expression and has alignment
 /// equal to or less than that of the original expression.
 Constant *ConvertInitializer(tree exp) {
-  assert(TREE_CONSTANT(exp) && "Isn't a constant!");
-
   Constant *Init;
   switch (TREE_CODE(exp)) {
   default:





More information about the llvm-commits mailing list