[llvm-bugs] [Bug 32638] New: Compiler crash (segmentation fault) on well-formed generic lambda with `noexcept(noexcept(...))` specifier

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Apr 12 07:02:34 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=32638

            Bug ID: 32638
           Summary: Compiler crash (segmentation fault) on well-formed
                    generic lambda with `noexcept(noexcept(...))`
                    specifier
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: vittorio.romeo at outlook.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Consider the following code:

    int main()
    {
        [](auto x) noexcept(noexcept(x)) { } (0);
    }

On wandbox: https://wandbox.org/permlink/nzGhm7G6lZ2Zf24X

This crashes clang++ 5 HEAD, 4.0.0, 3.9.1, 3.8, 3.7. It seems to work on 3.6.  
On godbolt: https://godbolt.org/g/BXql91

Here's the output for clang++ 5 HEAD:

#0 0x0000000001933b54 PrintStackTraceSignalHandler(void*)
(/opt/wandbox/clang-head/bin/clang-5.0+0x1933b54)
#1 0x0000000001933e26 SignalHandler(int)
(/opt/wandbox/clang-head/bin/clang-5.0+0x1933e26)
#2 0x00007f1a85ea4390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#3 0x0000000002987483 clang::Sema::tryCaptureVariable(clang::VarDecl*,
clang::SourceLocation, clang::Sema::TryCaptureKind, clang::SourceLocation,
bool, clang::QualType&, clang::QualType&, unsigned int const*)
(/opt/wandbox/clang-head/bin/clang-5.0+0x2987483)
#4 0x000000000294f0b8 clang::Sema::BuildDeclRefExpr(clang::ValueDecl*,
clang::QualType, clang::ExprValueKind, clang::DeclarationNameInfo const&,
clang::CXXScopeSpec const*, clang::NamedDecl*, clang::TemplateArgumentListInfo
const*) (/opt/wandbox/clang-head/bin/clang-5.0+0x294f0b8)
#5 0x000000000295399b clang::Sema::BuildDeclarationNameExpr(clang::CXXScopeSpec
const&, clang::DeclarationNameInfo const&, clang::NamedDecl*,
clang::NamedDecl*, clang::TemplateArgumentListInfo const*, bool)
(/opt/wandbox/clang-head/bin/clang-5.0+0x295399b)
#6 0x0000000002bf8891 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformDeclRefExpr(clang::DeclRefExpr*)
(/opt/wandbox/clang-head/bin/clang-5.0+0x2bf8891)
#7 0x0000000002bed33b clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformCXXNoexceptExpr(clang::CXXNoexceptExpr*)
(/opt/wandbox/clang-head/bin/clang-5.0+0x2bed33b)
#8 0x0000000002be15cc clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformExceptionSpec(clang::SourceLocation,
clang::FunctionProtoType::ExceptionSpecInfo&,
llvm::SmallVectorImpl<clang::QualType>&, bool&)
(/opt/wandbox/clang-head/bin/clang-5.0+0x2be15cc)
#9 0x0000000002be1530 clang::Sema::SubstExceptionSpec(clang::FunctionDecl*,
clang::FunctionProtoType const*, clang::MultiLevelTemplateArgumentList const&)
(/opt/wandbox/clang-head/bin/clang-5.0+0x2be1530)
#10 0x0000000002c114b7
clang::TemplateDeclInstantiator::InitFunctionInstantiation(clang::FunctionDecl*,
clang::FunctionDecl*) (/opt/wandbox/clang-head/bin/clang-5.0+0x2c114b7)
#11 0x0000000002c0ed0b
clang::TemplateDeclInstantiator::VisitCXXMethodDecl(clang::CXXMethodDecl*,
clang::TemplateParameterList*, bool)
(/opt/wandbox/clang-head/bin/clang-5.0+0x2c0ed0b)
#12 0x0000000002c15908 clang::TemplateDeclInstantiator::VisitDecl(clang::Decl*)
(/opt/wandbox/clang-head/bin/clang-5.0+0x2c15908)
#13 0x0000000002badf2c
clang::Sema::FinishTemplateArgumentDeduction(clang::FunctionTemplateDecl*,
llvm::SmallVectorImpl<clang::DeducedTemplateArgument>&, unsigned int,
clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&,
llvm::SmallVectorImpl<clang::Sema::OriginalCallArg> const*, bool,
llvm::function_ref<bool ()>) (/opt/wandbox/clang-head/bin/clang-5.0+0x2badf2c)
#14 0x0000000002baf7f9
clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*,
clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>,
clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, bool,
llvm::function_ref<bool (llvm::ArrayRef<clang::QualType>)>)
(/opt/wandbox/clang-head/bin/clang-5.0+0x2baf7f9)
#15 0x0000000002aee919
clang::Sema::AddMethodTemplateCandidate(clang::FunctionTemplateDecl*,
clang::DeclAccessPair, clang::CXXRecordDecl*, clang::TemplateArgumentListInfo*,
clang::QualType, clang::Expr::Classification, llvm::ArrayRef<clang::Expr*>,
clang::OverloadCandidateSet&, bool, bool)
(/opt/wandbox/clang-head/bin/clang-5.0+0x2aee919)
#16 0x0000000002b074a5 clang::Sema::BuildCallToObjectOfClassType(clang::Scope*,
clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>,
clang::SourceLocation) (/opt/wandbox/clang-head/bin/clang-5.0+0x2b074a5)
#17 0x000000000294ac4b clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*,
clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>,
clang::SourceLocation, clang::Expr*, bool)
(/opt/wandbox/clang-head/bin/clang-5.0+0x294ac4b)
#18 0x000000000257cc16
clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*,
true>) (/opt/wandbox/clang-head/bin/clang-5.0+0x257cc16)
#19 0x0000000002581b4a clang::Parser::ParseCastExpression(bool, bool, bool&,
clang::Parser::TypeCastState, bool)
(/opt/wandbox/clang-head/bin/clang-5.0+0x2581b4a)
#20 0x000000000257a63f
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState)
(/opt/wandbox/clang-head/bin/clang-5.0+0x257a63f)
#21 0x000000000257a589
clang::Parser::ParseExpression(clang::Parser::TypeCastState)
(/opt/wandbox/clang-head/bin/clang-5.0+0x257a589)
#22 0x00000000025bb776 clang::Parser::ParseExprStatement()
(/opt/wandbox/clang-head/bin/clang-5.0+0x25bb776)
#23 0x00000000025ba829
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedConstructsKind, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
(/opt/wandbox/clang-head/bin/clang-5.0+0x25ba829)
#24 0x00000000025ba3ab
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedConstructsKind, clang::SourceLocation*)
(/opt/wandbox/clang-head/bin/clang-5.0+0x25ba3ab)
#25 0x00000000025c12fa clang::Parser::ParseCompoundStatementBody(bool)
(/opt/wandbox/clang-head/bin/clang-5.0+0x25c12fa)
#26 0x00000000025c1c46 clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) (/opt/wandbox/clang-head/bin/clang-5.0+0x25c1c46)
#27 0x000000000253e8de
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
(/opt/wandbox/clang-head/bin/clang-5.0+0x253e8de)
#28 0x0000000002554847 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
unsigned int, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/opt/wandbox/clang-head/bin/clang-5.0+0x2554847)
#29 0x000000000253d833
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/opt/wandbox/clang-head/bin/clang-5.0+0x253d833)
#30 0x000000000253d199
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
(/opt/wandbox/clang-head/bin/clang-5.0+0x253d199)
#31 0x000000000253c6e4
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/opt/wandbox/clang-head/bin/clang-5.0+0x253c6e4)
#32 0x000000000253b819
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/opt/wandbox/clang-head/bin/clang-5.0+0x253b819)
#33 0x000000000253b1e9
clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/opt/wandbox/clang-head/bin/clang-5.0+0x253b1e9)
#34 0x0000000002537840 clang::ParseAST(clang::Sema&, bool, bool)
(/opt/wandbox/clang-head/bin/clang-5.0+0x2537840)
#35 0x0000000001e08bcf clang::FrontendAction::Execute()
(/opt/wandbox/clang-head/bin/clang-5.0+0x1e08bcf)
#36 0x0000000001dcd148
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/opt/wandbox/clang-head/bin/clang-5.0+0x1dcd148)
#37 0x0000000001e8ddbf
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/opt/wandbox/clang-head/bin/clang-5.0+0x1e8ddbf)
#38 0x0000000000835385 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/opt/wandbox/clang-head/bin/clang-5.0+0x835385)
#39 0x0000000000834380 main (/opt/wandbox/clang-head/bin/clang-5.0+0x834380)
#40 0x00007f1a84c14830 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x20830)
#41 0x0000000000831319 _start (/opt/wandbox/clang-head/bin/clang-5.0+0x831319)
Stack dump:
0.      Program arguments: /opt/wandbox/clang-head/bin/clang-5.0 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -discard-value-names -main-file-name prog.cc
-mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -nostdinc++
-resource-dir /opt/wandbox/clang-head/lib/clang/5.0.0 -I
/opt/wandbox/clang-head/include/c++/v1 -I /opt/wandbox/boost-sml/include -I
/opt/wandbox/boost-di/include -I /opt/wandbox/range-v3/include -I
/opt/wandbox/nlohmann-json/src -D BOOST_NO_AUTO_PTR -I
/opt/wandbox/boost-1.63.0/clang-head/include -internal-isystem
/usr/local/include -internal-isystem
/opt/wandbox/clang-head/lib/clang/5.0.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -Wall -Wextra -std=c++1z
-fdeprecated-macro -fdebug-compilation-dir /home/jail -ferror-limit 19
-fmessage-length 0 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -fansi-escape-codes -o
/tmp/prog-6ec8be.o -x c++ prog.cc 
1.      prog.cc:3:44: current parser token ')'
2.      prog.cc:2:1: parsing function body 'main'
3.      prog.cc:2:1: in compound statement ('{}')
clang-5.0: error: unable to execute command: Segmentation fault
clang-5.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 5.0.0 (https://github.com/llvm-mirror/clang.git
44e7dd4bbbba32a53c0c57a3de45904b5fb084d6)
(https://github.com/llvm-mirror/llvm.git
d7dec945d06e8e4f95637d8e9add77bf383a2cbc)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/wandbox/clang-head/bin
clang-5.0: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang-5.0: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-5.0: note: diagnostic msg: /tmp/prog-71eb2e.cpp
clang-5.0: note: diagnostic msg: /tmp/prog-71eb2e.sh
clang-5.0: note: diagnostic msg: 

********************
254

-- 
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/20170412/73a90a6c/attachment-0001.html>


More information about the llvm-bugs mailing list