From c38daba25b66f9a0386fc28861db66e62663310d Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 5 Jan 2009 18:19:46 +0000 Subject: [PATCH] reject PR3281:crash09.ll with this diagnostic: llvm-as: crash09.ll:3:1: self referential type is invalid type %0 ^ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61720 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AsmParser/LLParser.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index da8cb4da23e..27dbf8871a6 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -238,6 +238,9 @@ bool LLParser::ParseUnnamedType() { std::map >::iterator FI = ForwardRefTypeIDs.find(TypeID); if (FI != ForwardRefTypeIDs.end()) { + if (FI->second.first.get() == Ty) + return Error(TypeLoc, "self referential type is invalid"); + cast(FI->second.first.get())->refineAbstractTypeTo(Ty); Ty = FI->second.first.get(); ForwardRefTypeIDs.erase(FI); @@ -275,6 +278,9 @@ bool LLParser::ParseNamedType() { std::map >::iterator FI = ForwardRefTypes.find(Name); if (FI != ForwardRefTypes.end()) { + if (FI->second.first.get() == Ty) + return Error(NameLoc, "self referential type is invalid"); + cast(FI->second.first.get())->refineAbstractTypeTo(Ty); Ty = FI->second.first.get(); ForwardRefTypes.erase(FI);