aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-01-05 08:18:44 +0000
committerChris Lattner <sabre@nondot.org>2009-01-05 08:18:44 +0000
commit0088a5cc722b9e32820d31c70175a7650ad4772d (patch)
tree61cfeb46774da7d1200e01ac936409ecb3a794d0
parentd31a672c097295eb9d0c4c89a6049f70f64be97c (diff)
downloadexternal_llvm-0088a5cc722b9e32820d31c70175a7650ad4772d.zip
external_llvm-0088a5cc722b9e32820d31c70175a7650ad4772d.tar.gz
external_llvm-0088a5cc722b9e32820d31c70175a7650ad4772d.tar.bz2
reject PR3281:crash07.ll with:
llvm-as: crash07.ll:2:32: va_arg requires operand with first class type %y = va_arg [52 x <{}>] %43, double (...) sspreq ^ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61683 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AsmParser/LLParser.cpp14
-rw-r--r--lib/AsmParser/LLParser.h2
2 files changed, 10 insertions, 6 deletions
diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp
index bdb9453..93dbcd8 100644
--- a/lib/AsmParser/LLParser.cpp
+++ b/lib/AsmParser/LLParser.cpp
@@ -2311,7 +2311,7 @@ bool LLParser::ParseInstruction(Instruction *&Inst, BasicBlock *BB,
case lltok::kw_ptrtoint: return ParseCast(Inst, PFS, Lex.getUIntVal());
// Other.
case lltok::kw_select: return ParseSelect(Inst, PFS);
- case lltok::kw_va_arg: return ParseVAArg(Inst, PFS);
+ case lltok::kw_va_arg: return ParseVA_Arg(Inst, PFS);
case lltok::kw_extractelement: return ParseExtractElement(Inst, PFS);
case lltok::kw_insertelement: return ParseInsertElement(Inst, PFS);
case lltok::kw_shufflevector: return ParseShuffleVector(Inst, PFS);
@@ -2735,15 +2735,19 @@ bool LLParser::ParseSelect(Instruction *&Inst, PerFunctionState &PFS) {
return false;
}
-/// ParseVAArg
-/// ::= 'vaarg' TypeAndValue ',' Type
-bool LLParser::ParseVAArg(Instruction *&Inst, PerFunctionState &PFS) {
+/// ParseVA_Arg
+/// ::= 'va_arg' TypeAndValue ',' Type
+bool LLParser::ParseVA_Arg(Instruction *&Inst, PerFunctionState &PFS) {
Value *Op;
PATypeHolder EltTy(Type::VoidTy);
+ LocTy TypeLoc;
if (ParseTypeAndValue(Op, PFS) ||
ParseToken(lltok::comma, "expected ',' after vaarg operand") ||
- ParseType(EltTy))
+ ParseType(EltTy, TypeLoc))
return true;
+
+ if (!EltTy->isFirstClassType())
+ return Error(TypeLoc, "va_arg requires operand with first class type");
Inst = new VAArgInst(Op, EltTy);
return false;
diff --git a/lib/AsmParser/LLParser.h b/lib/AsmParser/LLParser.h
index e064c68..2ac9260 100644
--- a/lib/AsmParser/LLParser.h
+++ b/lib/AsmParser/LLParser.h
@@ -252,7 +252,7 @@ namespace llvm {
bool ParseCompare(Instruction *&I, PerFunctionState &PFS, unsigned Opc);
bool ParseCast(Instruction *&I, PerFunctionState &PFS, unsigned Opc);
bool ParseSelect(Instruction *&I, PerFunctionState &PFS);
- bool ParseVAArg(Instruction *&I, PerFunctionState &PFS);
+ bool ParseVA_Arg(Instruction *&I, PerFunctionState &PFS);
bool ParseExtractElement(Instruction *&I, PerFunctionState &PFS);
bool ParseInsertElement(Instruction *&I, PerFunctionState &PFS);
bool ParseShuffleVector(Instruction *&I, PerFunctionState &PFS);