AsmParser: Make sure GlobalVariables have sane types
[oota-llvm.git] / lib / AsmParser / LLParser.cpp
index 159bbccc87db9a56036de73c5eabb589f3b2a5e9..7818586dfa45d80723ae6b62ca3c62ca47e27c18 100644 (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;