From 0aff0b2b58636633ce5b4ae5dc8f243739884267 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 5 Aug 2009 05:41:44 +0000 Subject: common globals may also not be marked constant. llvm-svn: 78169 --- llvm/lib/VMCore/Verifier.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'llvm/lib/VMCore/Verifier.cpp') 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. -- cgit v1.2.3