AsmParser: Make sure GlobalVariables have sane types

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229364 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Majnemer 2015-02-16 08:41:08 +00:00
parent b3dd3c7ac3
commit 40d10639cf
2 changed files with 5 additions and 1 deletions

View File

@ -749,7 +749,7 @@ bool LLParser::ParseGlobal(const std::string &Name, LocTy NameLoc,
return true;
}
if (Ty->isFunctionTy() || Ty->isLabelTy())
if (Ty->isFunctionTy() || !PointerType::isValidElementType(Ty))
return Error(TyLoc, "invalid type for global variable");
GlobalValue *GVal = nullptr;

View File

@ -0,0 +1,4 @@
; RUN: not llvm-as < %s 2>&1 | FileCheck %s
@gv = global metadata undef
; CHECK: invalid type for global variable