[llvm] r229364 - AsmParser: Make sure GlobalVariables have sane types
David Majnemer
david.majnemer at gmail.com
Mon Feb 16 00:41:12 PST 2015
Author: majnemer
Date: Mon Feb 16 02:41:08 2015
New Revision: 229364
URL: http://llvm.org/viewvc/llvm-project?rev=229364&view=rev
Log:
AsmParser: Make sure GlobalVariables have sane types
Added:
llvm/trunk/test/Assembler/gv-invalid-type.ll
Modified:
llvm/trunk/lib/AsmParser/LLParser.cpp
Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=229364&r1=229363&r2=229364&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Mon Feb 16 02:41:08 2015
@@ -749,7 +749,7 @@ bool LLParser::ParseGlobal(const std::st
return true;
}
- if (Ty->isFunctionTy() || Ty->isLabelTy())
+ if (Ty->isFunctionTy() || !PointerType::isValidElementType(Ty))
return Error(TyLoc, "invalid type for global variable");
GlobalValue *GVal = nullptr;
Added: llvm/trunk/test/Assembler/gv-invalid-type.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/gv-invalid-type.ll?rev=229364&view=auto
==============================================================================
--- llvm/trunk/test/Assembler/gv-invalid-type.ll (added)
+++ llvm/trunk/test/Assembler/gv-invalid-type.ll Mon Feb 16 02:41:08 2015
@@ -0,0 +1,4 @@
+; RUN: not llvm-as < %s 2>&1 | FileCheck %s
+
+ at gv = global metadata undef
+; CHECK: invalid type for global variable
More information about the llvm-commits
mailing list