AsmParser: Validate alloca's type
[oota-llvm.git] / lib / AsmParser / LLParser.cpp
index adf4c9073ab87ade648eb62a775b77661e3937c7..7af85b5846cddc11dbeb7f2d6d2e040fbf8ee595 100644 (file)
@@ -4633,6 +4633,9 @@ int LLParser::ParseAlloc(Instruction *&Inst, PerFunctionState &PFS) {
 
   if (ParseType(Ty)) return true;
 
+  if (!PointerType::isValidElementType(Ty))
+    return TokError("pointer to this type is invalid");
+
   bool AteExtraComma = false;
   if (EatIfPresent(lltok::comma)) {
     if (Lex.getKind() == lltok::kw_align) {