[LLVMbugs] [Bug 22396] New: clang: infinite loop in clang::Sema::CreateOverloadedBinOp on invalid input

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jan 29 17:22:29 PST 2015


http://llvm.org/bugs/show_bug.cgi?id=22396

            Bug ID: 22396
           Summary: clang: infinite loop in
                    clang::Sema::CreateOverloadedBinOp on invalid input
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: kcc at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Not sure how useful such report is, but it pops us very early if I am trying to
fuzz clang. 

template<int N> struct S { };
template<typename T> S<T() + T()> operator+(T, T);
S<0> s;
int k = s + s;


% clang -cc1 z.cc 
<some error messages follow, then clang hangs>

Stacks looks like this: 

#0  0x0000000001700b7d in clang::VarDecl::getInit() const ()
#1  0x0000000002859763 in clang::FunctionDecl::getMinRequiredArguments() const
()
#2  0x00000000024928ea in
clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*,
clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>,
clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, bool) ()
#3  0x00000000023d0479 in
clang::Sema::AddTemplateOverloadCandidate(clang::FunctionTemplateDecl*,
clang::DeclAccessPair, clang::TemplateArgumentListInfo*,
llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, bool) ()
#4  0x00000000023d78dd in
clang::Sema::AddArgumentDependentLookupCandidates(clang::DeclarationName,
clang::SourceLocation, llvm::ArrayRef<clang::Expr*>,
clang::TemplateArgumentListInfo*, clang::OverloadCandidateSet&, bool) ()
#5  0x00000000023e2330 in
clang::Sema::CreateOverloadedBinOp(clang::SourceLocation, unsigned int,
clang::UnresolvedSetImpl const&, clang::Expr*, clang::Expr*) ()
#6  0x000000000228aa73 in clang::Sema::BuildBinOp(clang::Scope*,
clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*)
()
#7  0x00000000024e2c83 in clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformBinaryOperator(clang::BinaryOperator*)
()
#8  0x00000000024d8dec in clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformTemplateArgument(clang::TemplateArgumentLoc
const&, clang::TemplateArgumentLoc&) ()
#9  0x00000000024da0b3 in clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformTemplateSpecializationType(clang::TypeLocBuilder&,
clang::TemplateSpecializationTypeLoc, clang::TemplateName) ()

This hang by itself might not be interesting, but if there is an interest in
fuzzing clang these will need to be fixed. 
FTR, I am also hitting http://llvm.org/bugs/show_bug.cgi?id=21954

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150130/76ef2edd/attachment.html>


More information about the llvm-bugs mailing list