summaryrefslogtreecommitdiffstats
path: root/llvm/lib/AsmParser
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-01-05 08:13:38 +0000
committerChris Lattner <sabre@nondot.org>2009-01-05 08:13:38 +0000
commitffa0778c36c633d1d8f152f59468397eab02fced (patch)
treea8b58268e9486fbe3efcaefed01a498fc144d02c /llvm/lib/AsmParser
parentc38e99547e61534ad273451f4d8fa2a042d61e80 (diff)
downloadbcm5719-llvm-ffa0778c36c633d1d8f152f59468397eab02fced.tar.gz
bcm5719-llvm-ffa0778c36c633d1d8f152f59468397eab02fced.zip
reject undef/zero labels. This fixes PR3281:crash0[56].ll with these
diagnostics: llvm-as: crash05.ll:1:14: invalid type for null constant global label zeroinitializer addrspace (75), section "c" ^ llvm-as: crash06.ll:2:14: invalid type for null constant udiv label zeroinitializer, @0 ^ llvm-svn: 61681
Diffstat (limited to 'llvm/lib/AsmParser')
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 68946393119..bdb94530706 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -1906,6 +1906,9 @@ bool LLParser::ConvertGlobalValIDToValue(const Type *Ty, ValID &ID,
V = ConstantPointerNull::get(cast<PointerType>(Ty));
return false;
case ValID::t_Undef:
+ // FIXME: LabelTy should not be a first-class type.
+ if (!Ty->isFirstClassType() || Ty == Type::LabelTy)
+ return Error(ID.Loc, "invalid type for undef constant");
V = UndefValue::get(Ty);
return false;
case ValID::t_EmptyArray:
@@ -1914,7 +1917,8 @@ bool LLParser::ConvertGlobalValIDToValue(const Type *Ty, ValID &ID,
V = UndefValue::get(Ty);
return false;
case ValID::t_Zero:
- if (!Ty->isFirstClassType())
+ // FIXME: LabelTy should not be a first-class type.
+ if (!Ty->isFirstClassType() || Ty == Type::LabelTy)
return Error(ID.Loc, "invalid type for null constant");
V = Constant::getNullValue(Ty);
return false;
OpenPOWER on IntegriCloud