diff options
author | Chris Lattner <sabre@nondot.org> | 2009-01-05 18:27:50 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-01-05 18:27:50 +0000 |
commit | 830703b1bd88511e29eec76b1fd146524bc9c5a1 (patch) | |
tree | 3b6e03760efae23af4659b20f9a13c133844aebb | |
parent | 959873d2da763c0e3b3c67c39aab179fc43c5a52 (diff) | |
download | external_llvm-830703b1bd88511e29eec76b1fd146524bc9c5a1.zip external_llvm-830703b1bd88511e29eec76b1fd146524bc9c5a1.tar.gz external_llvm-830703b1bd88511e29eec76b1fd146524bc9c5a1.tar.bz2 |
reject PR3281:crash11.ll with:
llvm-as: crash11.ll:2:27: function may not return return opaque type
"xw" = tail call opaque @608(label %31)
^
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61722 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AsmParser/LLParser.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index c13737a..a9f8e19 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -602,11 +602,17 @@ GlobalValue *LLParser::GetGlobalVal(unsigned ID, const Type *Ty, LocTy Loc) { // Otherwise, create a new forward reference for this value and remember it. GlobalValue *FwdVal; - if (const FunctionType *FT = dyn_cast<FunctionType>(PTy->getElementType())) + if (const FunctionType *FT = dyn_cast<FunctionType>(PTy->getElementType())) { + // Function types can return opaque but functions can't. + if (isa<OpaqueType>(FT->getReturnType())) { + Error(Loc, "function may not return return opaque type"); + return 0; + } FwdVal = Function::Create(FT, GlobalValue::ExternalWeakLinkage, "", M); - else + } else { FwdVal = new GlobalVariable(PTy->getElementType(), false, GlobalValue::ExternalWeakLinkage, 0, "", M); + } ForwardRefValIDs[ID] = std::make_pair(FwdVal, Loc); return FwdVal; |