aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/Verifier.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-05 05:41:44 +0000
committerChris Lattner <sabre@nondot.org>2009-08-05 05:41:44 +0000
commitcd81f5df27c9a47561be1b9a4059ca3a5dcace4c (patch)
treef1143daa3ac0b91b44481b134733a40d20cf63fe /lib/VMCore/Verifier.cpp
parent40a0b2c305344898fd4e46e988d16846cd5cd6b2 (diff)
downloadexternal_llvm-cd81f5df27c9a47561be1b9a4059ca3a5dcace4c.zip
external_llvm-cd81f5df27c9a47561be1b9a4059ca3a5dcace4c.tar.gz
external_llvm-cd81f5df27c9a47561be1b9a4059ca3a5dcace4c.tar.bz2
common globals may also not be marked constant.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78169 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Verifier.cpp')
-rw-r--r--lib/VMCore/Verifier.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index f50299b..9ca0488 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.