summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 27dbf8871a6..c13737aae52 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -1911,6 +1911,11 @@ bool LLParser::ConvertGlobalValIDToValue(const Type *Ty, ValID &ID,
&Ignored);
}
V = ConstantFP::get(ID.APFloatVal);
+
+ if (V->getType() != Ty)
+ return Error(ID.Loc, "floating point constant does not have type '" +
+ Ty->getDescription() + "'");
+
return false;
case ValID::t_Null:
if (!isa<PointerType>(Ty))
OpenPOWER on IntegriCloud