summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit0aff0b2b58636633ce5b4ae5dc8f243739884267 (patch)
treef71c88ce2612cbb9f671da1c9079ad5616d952f7 /llvm/lib/VMCore/Verifier.cpp
parent99709de6ae58f68deb12093e31ca130719942a9b (diff)
downloadbcm5719-llvm-0aff0b2b58636633ce5b4ae5dc8f243739884267.tar.gz
bcm5719-llvm-0aff0b2b58636633ce5b4ae5dc8f243739884267.zip
common globals may also not be marked constant.
llvm-svn: 78169
Diffstat (limited to 'llvm/lib/VMCore/Verifier.cpp')
-rw-r--r--llvm/lib/VMCore/Verifier.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/VMCore/Verifier.cpp b/llvm/lib/VMCore/Verifier.cpp
index f50299bdc0c..9ca048838e4 100644
--- a/llvm/lib/VMCore/Verifier.cpp
+++ b/llvm/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.
OpenPOWER on IntegriCloud