diff options
author | Chris Lattner <sabre@nondot.org> | 2007-08-06 21:00:37 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-08-06 21:00:37 +0000 |
commit | 6df20efcc33aa4f730f4d6406e11b9fe1efd377e (patch) | |
tree | 84af46add93ff837105886a82a3dc4686e92eb44 | |
parent | a583990ec83a4773608084a9694943ddd268e571 (diff) | |
download | external_llvm-6df20efcc33aa4f730f4d6406e11b9fe1efd377e.zip external_llvm-6df20efcc33aa4f730f4d6406e11b9fe1efd377e.tar.gz external_llvm-6df20efcc33aa4f730f4d6406e11b9fe1efd377e.tar.bz2 |
Fix PR1577, a crash on invalid bug.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40874 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AsmParser/llvmAsmParser.y | 1 | ||||
-rw-r--r-- | test/Assembler/2007-08-06-AliasInvalid.ll | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index 9d7b063..adf6ead 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/lib/AsmParser/llvmAsmParser.y @@ -1980,6 +1980,7 @@ ThreadLocal : THREAD_LOCAL { $$ = true; } | { $$ = false; }; AliaseeRef : ResultTypes SymbolicValueRef { const Type* VTy = $1->get(); Value *V = getVal(VTy, $2); + CHECK_FOR_ERROR GlobalValue* Aliasee = dyn_cast<GlobalValue>(V); if (!Aliasee) GEN_ERROR("Aliases can be created only to global values"); diff --git a/test/Assembler/2007-08-06-AliasInvalid.ll b/test/Assembler/2007-08-06-AliasInvalid.ll new file mode 100644 index 0000000..0711e03 --- /dev/null +++ b/test/Assembler/2007-08-06-AliasInvalid.ll @@ -0,0 +1,7 @@ +; RUN: llvm-as < %s > /dev/null |& grep {Invalid type for reference to global} +; PR1577 + +@anInt = global i32 1 alias i32 @anAlias +define i32 @main() { + ret i32 0 +} |