[llvm-bugs] [Bug 41922] New: lambda as default template argument causes segfault on template instanciation

via llvm-bugs llvm-bugs at lists.llvm.org
Fri May 17 04:15:47 PDT 2019


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

            Bug ID: 41922
           Summary: lambda as default template argument causes segfault on
                    template instanciation
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: bastienPenava at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

link: https://godbolt.org/z/Nmlzx6

code:
template<auto = []{}> void func();
int main()
{
   func(); //segfault whilst parsing
   func();
}

output:

lang version 9.0.0 (trunk 360967)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/compiler-explorer/clang-trunk/bin
Found candidate GCC installation:
/opt/compiler-explorer/gcc-8.3.0/lib/gcc/x86_64-linux-gnu/8.3.0
Selected GCC installation:
/opt/compiler-explorer/gcc-8.3.0/lib/gcc/x86_64-linux-gnu/8.3.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
 "/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9" -cc1 -triple
x86_64-unknown-linux-gnu -S -disable-free -disable-llvm-verifier
-discard-value-names -main-file-name example.cpp -mrelocation-model static
-mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info
-debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb
-momit-leaf-frame-pointer -v -coverage-notes-file /home/ubuntu/./output.gcno
-resource-dir /opt/compiler-explorer/clang-trunk-20190517/lib/clang/9.0.0
-internal-isystem
/opt/compiler-explorer/gcc-8.3.0/lib/gcc/x86_64-linux-gnu/8.3.0/../../../../include/c++/8.3.0
-internal-isystem
/opt/compiler-explorer/gcc-8.3.0/lib/gcc/x86_64-linux-gnu/8.3.0/../../../../include/c++/8.3.0/x86_64-linux-gnu
-internal-isystem
/opt/compiler-explorer/gcc-8.3.0/lib/gcc/x86_64-linux-gnu/8.3.0/../../../../include/c++/8.3.0/backward
-internal-isystem /usr/local/include -internal-isystem
/opt/compiler-explorer/clang-trunk-20190517/lib/clang/9.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O3
-std=c++2a -fdeprecated-macro -fdebug-compilation-dir /home/ubuntu
-ferror-limit 19 -fmessage-length 0 -fno-implicit-modules -fobjc-runtime=gcc
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics
-vectorize-loops -vectorize-slp -mllvm --x86-asm-syntax=intel -o ./output.s -x
c++ ./example.cpp -faddrsig
clang -cc1 version 9.0.0 based upon LLVM 9.0.0svn default target
x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:

/opt/compiler-explorer/gcc-8.3.0/lib/gcc/x86_64-linux-gnu/8.3.0/../../../../include/c++/8.3.0

/opt/compiler-explorer/gcc-8.3.0/lib/gcc/x86_64-linux-gnu/8.3.0/../../../../include/c++/8.3.0/x86_64-linux-gnu

/opt/compiler-explorer/gcc-8.3.0/lib/gcc/x86_64-linux-gnu/8.3.0/../../../../include/c++/8.3.0/backward
 /usr/local/include
 /opt/compiler-explorer/clang-trunk-20190517/lib/clang/9.0.0/include
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
Stack dump:
0.      Program arguments:
/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9 -cc1 -triple
x86_64-unknown-linux-gnu -S -disable-free -disable-llvm-verifier
-discard-value-names -main-file-name example.cpp -mrelocation-model static
-mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info
-debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb
-momit-leaf-frame-pointer -v -coverage-notes-file /home/ubuntu/./output.gcno
-resource-dir /opt/compiler-explorer/clang-trunk-20190517/lib/clang/9.0.0
-internal-isystem
/opt/compiler-explorer/gcc-8.3.0/lib/gcc/x86_64-linux-gnu/8.3.0/../../../../include/c++/8.3.0
-internal-isystem
/opt/compiler-explorer/gcc-8.3.0/lib/gcc/x86_64-linux-gnu/8.3.0/../../../../include/c++/8.3.0/x86_64-linux-gnu
-internal-isystem
/opt/compiler-explorer/gcc-8.3.0/lib/gcc/x86_64-linux-gnu/8.3.0/../../../../include/c++/8.3.0/backward
-internal-isystem /usr/local/include -internal-isystem
/opt/compiler-explorer/clang-trunk-20190517/lib/clang/9.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O3
-std=c++2a -fdeprecated-macro -fdebug-compilation-dir /home/ubuntu
-ferror-limit 19 -fmessage-length 0 -fno-implicit-modules -fobjc-runtime=gcc
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics
-vectorize-loops -vectorize-slp -mllvm --x86-asm-syntax=intel -o ./output.s -x
c++ ./example.cpp -faddrsig 
1.      <eof> parser at end of file
2.      ./example.cpp:3:5: LLVM IR generation of declaration 'main'
3.      ./example.cpp:3:5: Generating code for declaration 'main'
4.      ./example.cpp:1:28: Mangling declaration 'func'
 #0 0x000055775a11549a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x269849a)
 #1 0x000055775a113254 llvm::sys::RunSignalHandlers()
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x2696254)
 #2 0x000055775a113392 SignalHandler(int)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x2696392)
 #3 0x00007f2742ada890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #4 0x000055775bf5cbe0 (anonymous
namespace)::CXXNameMangler::mangleExpression(clang::Expr const*, unsigned
int)(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x44dfbe0)
 #5 0x000055775bf5f1d3 (anonymous
namespace)::CXXNameMangler::mangleTemplateArg(clang::TemplateArgument)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x44e21d3)
 #6 0x000055775bf5fc8f (anonymous
namespace)::CXXNameMangler::mangleTemplateArgs(clang::TemplateArgumentList
const&) (/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x44e2c8f)
 #7 0x000055775bf6346f (anonymous
namespace)::CXXNameMangler::mangleNameWithAbiTags(clang::NamedDecl const*,
llvm::SmallVector<llvm::StringRef, 4u> const*)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x44e646f)
 #8 0x000055775bf5e4b4 (anonymous
namespace)::CXXNameMangler::mangleFunctionEncoding(clang::FunctionDecl const*)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x44e14b4)
 #9 0x000055775bf62366 (anonymous
namespace)::ItaniumMangleContextImpl::mangleCXXName(clang::NamedDecl const*,
llvm::raw_ostream&)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x44e5366)
#10 0x000055775a3c940c getMangledNameImpl(clang::CodeGen::CodeGenModule const&,
clang::GlobalDecl, clang::NamedDecl const*, bool)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x294c40c)
#11 0x000055775a3d71d5
clang::CodeGen::CodeGenModule::getMangledName(clang::GlobalDecl)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x295a1d5)
#12 0x000055775a3fbcc5
clang::CodeGen::CodeGenModule::GetAddrOfFunction(clang::GlobalDecl,
llvm::Type*, bool, bool, clang::CodeGen::ForDefinition_t)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x297ecc5)
#13 0x000055775a5490d3 EmitFunctionDeclPointer(clang::CodeGen::CodeGenModule&,
clang::FunctionDecl const*)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x2acc0d3)
#14 0x000055775a563244 clang::CodeGen::CodeGenFunction::EmitCallee(clang::Expr
const*) (/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x2ae6244)
#15 0x000055775a5632f2
clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x2ae62f2)
#16 0x000055775a597969 (anonymous
namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x2b1a969)
#17 0x000055775a594fab (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x2b17fab)
#18 0x000055775a5972b0
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x2b1a2b0)
#19 0x000055775a54b5cf clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr
const*, clang::CodeGen::AggValueSlot, bool)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x2ace5cf)
#20 0x000055775a55bb7e
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x2adeb7e)
#21 0x000055775a37b043 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x28fe043)
#22 0x000055775a37b5d3
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x28fe5d3)
#23 0x000055775a3b5f61
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x2938f61)
#24 0x000055775a3be42e
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x294142e)
#25 0x000055775a3fc049
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x297f049)
#26 0x000055775a3f9f25
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x297cf25)
#27 0x000055775a3fa5a3
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x297d5a3)
#28 0x000055775a3ff58f
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.4526)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x298258f)
#29 0x000055775ae3a101 (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x33bd101)
#30 0x000055775ae2ed56
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x33b1d56)
#31 0x000055775b5e26d4 clang::ParseAST(clang::Sema&, bool, bool)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x3b656d4)
#32 0x000055775ae37107 clang::CodeGenAction::ExecuteAction()
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x33ba107)
#33 0x000055775a7d4c16 clang::FrontendAction::Execute()
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x2d57c16)
#34 0x000055775a79780c
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x2d1a80c)
#35 0x000055775a8932a3
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0x2e162a3)
#36 0x000055775870a650 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0xc8d650)
#37 0x000055775866aad2 main
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0xbedad2)
#38 0x00007f2741998b97 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x21b97)
#39 0x0000557758707c4a _start
(/opt/compiler-explorer/clang-trunk-20190517/bin/clang-9+0xc8ac4a)
clang-9: error: unable to execute command: Segmentation fault (core dumped)
clang-9: error: clang frontend command failed due to signal (use -v to see
invocation)
Compiler returned: 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/20190517/93f85942/attachment-0001.html>


More information about the llvm-bugs mailing list