[llvm-commits] [dragonegg] r155124 - in /dragonegg/trunk/src: Backend.cpp Constants.cpp Convert.cpp
Duncan Sands
baldrick at free.fr
Thu Apr 19 06:19:38 PDT 2012
Author: baldrick
Date: Thu Apr 19 08:19:38 2012
New Revision: 155124
URL: http://llvm.org/viewvc/llvm-project?rev=155124&view=rev
Log:
In gcc-4.7 a CONST_DECL does not satisfy HAS_RTL_P, causing the plugin to crash
on basically any Fortran program. Workaround this.
Modified:
dragonegg/trunk/src/Backend.cpp
dragonegg/trunk/src/Constants.cpp
dragonegg/trunk/src/Convert.cpp
Modified: dragonegg/trunk/src/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=155124&r1=155123&r2=155124&view=diff
==============================================================================
--- dragonegg/trunk/src/Backend.cpp (original)
+++ dragonegg/trunk/src/Backend.cpp Thu Apr 19 08:19:38 2012
@@ -145,7 +145,8 @@
/// set_decl_llvm - Remember the LLVM value for a GCC declaration.
Value *set_decl_llvm(tree t, Value *V) {
- assert(HAS_RTL_P(t) && "Expected a declaration with RTL!");
+ assert((isa<CONST_DECL>(t) || HAS_RTL_P(t)) &&
+ "Expected a declaration with RTL!");
assert((!V || isa<GlobalValue>(V)) && "Expected a global value!");
setCachedValue(t, V);
return V;
@@ -153,7 +154,8 @@
/// get_decl_llvm - Retrieve the LLVM value for a GCC declaration, or NULL.
Value *get_decl_llvm(tree t) {
- assert(HAS_RTL_P(t) && "Expected a declaration with RTL!");
+ assert((isa<CONST_DECL>(t) || HAS_RTL_P(t)) &&
+ "Expected a declaration with RTL!");
Value *V = getCachedValue(t);
return V ? V->stripPointerCasts() : 0;
}
@@ -1083,8 +1085,9 @@
// Global register variable with asm name, e.g.:
// register unsigned long esp __asm__("ebp");
- if (!isa<FUNCTION_DECL>(decl) && DECL_REGISTER(decl)) {
- // This just verifies that the variable is ok. The actual "load/store"
+ if (!isa<FUNCTION_DECL>(decl) && !isa<CONST_DECL>(decl) &&
+ DECL_REGISTER(decl)) {
+ // This just verifies that the variable is ok. The actual "load/store"
// code paths handle accesses to the variable.
ValidateRegisterVariable(decl);
return NULL;
Modified: dragonegg/trunk/src/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Constants.cpp?rev=155124&r1=155123&r2=155124&view=diff
==============================================================================
--- dragonegg/trunk/src/Constants.cpp (original)
+++ dragonegg/trunk/src/Constants.cpp Thu Apr 19 08:19:38 2012
@@ -1384,7 +1384,8 @@
/// ConvertInitializerImpl - Implementation of ConvertInitializer.
static Constant *ConvertInitializerImpl(tree exp, TargetFolder &Folder) {
- assert(!HAS_RTL_P(exp) && "Cache collision with decl_llvm!");
+ assert(!isa<CONST_DECL>(exp) && !HAS_RTL_P(exp) &&
+ "Cache collision with decl_llvm!");
// If we already converted the initializer then return the cached copy.
if (Constant *C = cast_or_null<Constant>(getCachedValue(exp)))
Modified: dragonegg/trunk/src/Convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Convert.cpp?rev=155124&r1=155123&r2=155124&view=diff
==============================================================================
--- dragonegg/trunk/src/Convert.cpp (original)
+++ dragonegg/trunk/src/Convert.cpp Thu Apr 19 08:19:38 2012
@@ -621,6 +621,7 @@
/// isLocalDecl - Whether this declaration is local to the current function.
static bool isLocalDecl(tree decl) {
+ if (isa<CONST_DECL>(decl)) return false;
assert(HAS_RTL_P(decl) && "Expected a declaration with RTL!");
return
// GCC bug workaround: RESULT_DECL may not have DECL_CONTEXT set in thunks.
More information about the llvm-commits
mailing list