diff options
Diffstat (limited to 'lib/VMCore/Verifier.cpp')
-rw-r--r-- | lib/VMCore/Verifier.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index f50299bdc0..9ca048838e 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -378,11 +378,14 @@ void Verifier::visitGlobalVariable(GlobalVariable &GV) { "Global variable initializer type does not match global " "variable type!", &GV); - // If the global has common linkage, it must have a zero initializer. - if (GV.hasCommonLinkage()) + // If the global has common linkage, it must have a zero initializer and + // cannot be constant. + if (GV.hasCommonLinkage()) { Assert1(GV.getInitializer()->isNullValue(), "'common' global must have a zero initializer!", &GV); - + Assert1(!GV.isConstant(), "'common' global may not be marked constant!", + &GV); + } // Verify that any metadata used in a global initializer points only to // other globals. |