[llvm-bugs] [Bug 48031] New: ICE on valid, regression since version 9.0: noexcept clause using template variable in template class causes Segfault
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Oct 31 02:49:09 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=48031
Bug ID: 48031
Summary: ICE on valid, regression since version 9.0: noexcept
clause using template variable in template class
causes Segfault
Product: clang
Version: 9.0
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++14
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
Hi,
I've just found a very weird bug where CLANG Segfault.
You can find bellow:
- godbolt link of the example, ICE with clang-9.0: https://godbolt.org/z/evs554
- godbolt link with the example working with clang-8.0:
https://godbolt.org/z/z7es91
Minimal example:
```
template<class T>
constexpr void increment(T const &) {}
template<int = 0>
struct Bad {
template<class T>
static constexpr auto obj = 42;
template<class T>
static constexpr void append() noexcept(noexcept(increment(obj<T>))) {}
//error here
};
int main()
{
Bad<>::append<int>();
}
```
Traceback:
```
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-9.0.0/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 -mdisable-fp-elim -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 -coverage-notes-file /home/ce/./output.gcno -resource-dir
/opt/compiler-explorer/clang-9.0.0/lib/clang/9.0.0 -internal-isystem
/opt/compiler-explorer/gcc-9.2.0/lib/gcc/x86_64-linux-gnu/9.2.0/../../../../include/c++/9.2.0
-internal-isystem
/opt/compiler-explorer/gcc-9.2.0/lib/gcc/x86_64-linux-gnu/9.2.0/../../../../include/c++/9.2.0/x86_64-linux-gnu
-internal-isystem
/opt/compiler-explorer/gcc-9.2.0/lib/gcc/x86_64-linux-gnu/9.2.0/../../../../include/c++/9.2.0/backward
-internal-isystem /usr/local/include -internal-isystem
/opt/compiler-explorer/clang-9.0.0/lib/clang/9.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-std=c++14 -fdeprecated-macro -fdebug-compilation-dir /home/ce -ferror-limit 19
-fmessage-length 0 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -mllvm --x86-asm-syntax=intel
-faddrsig -o ./output.s -x c++ <source>
1. <eof> parser at end of file
2. Per-file LLVM IR generation
3. <source>:18:27: Generating code for declaration 'Bad<0>::append'
#0 0x0000561abec7276a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/opt/compiler-explorer/clang-9.0.0/bin/clang-9+0x27db76a)
#1 0x0000561abec70524 llvm::sys::RunSignalHandlers()
(/opt/compiler-explorer/clang-9.0.0/bin/clang-9+0x27d9524)
#2 0x0000561abec70662 SignalHandler(int)
(/opt/compiler-explorer/clang-9.0.0/bin/clang-9+0x27d9662)
#3 0x00007f284889b3c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
#4 0x0000561abee9f518 UnwrapTypeForDebugInfo(clang::QualType,
clang::ASTContext const&)
(/opt/compiler-explorer/clang-9.0.0/bin/clang-9+0x2a08518)
#5 0x0000561abeeb404b
clang::CodeGen::CGDebugInfo::getOrCreateType(clang::QualType, llvm::DIFile*)
(/opt/compiler-explorer/clang-9.0.0/bin/clang-9+0x2a1d04b)
#6 0x0000561abeeb610b
clang::CodeGen::CGDebugInfo::CreateRecordStaticField(clang::VarDecl const*,
llvm::DIType*, clang::RecordDecl const*)
(/opt/compiler-explorer/clang-9.0.0/bin/clang-9+0x2a1f10b)
#7 0x0000561abeeb6a33
clang::CodeGen::CGDebugInfo::CollectRecordFields(clang::RecordDecl const*,
llvm::DIFile*, llvm::SmallVectorImpl<llvm::Metadata*>&, llvm::DICompositeType*)
(/opt/compiler-explorer/clang-9.0.0/bin/clang-9+0x2a1fa33)
#8 0x0000561abeeb3839
clang::CodeGen::CGDebugInfo::CreateTypeDefinition(clang::RecordType const*)
(/opt/compiler-explorer/clang-9.0.0/bin/clang-9+0x2a1c839)
#9 0x0000561abeeb4096
clang::CodeGen::CGDebugInfo::getOrCreateType(clang::QualType, llvm::DIFile*)
(/opt/compiler-explorer/clang-9.0.0/bin/clang-9+0x2a1d096)
#10 0x0000561abeeb42b7
clang::CodeGen::CGDebugInfo::getContextDescriptor(clang::Decl const*,
llvm::DIScope*) (/opt/compiler-explorer/clang-9.0.0/bin/clang-9+0x2a1d2b7)
#11 0x0000561abeeb89f9
clang::CodeGen::CGDebugInfo::collectFunctionDeclProps(clang::GlobalDecl,
llvm::DIFile*, llvm::StringRef&, llvm::StringRef&, llvm::DIScope*&,
llvm::MDTupleTypedArrayWrapper<llvm::DINode>&, llvm::DINode::DIFlags&)
(/opt/compiler-explorer/clang-9.0.0/bin/clang-9+0x2a219f9)
#12 0x0000561abeebf599
clang::CodeGen::CGDebugInfo::EmitFunctionStart(clang::GlobalDecl,
clang::SourceLocation, clang::SourceLocation, clang::QualType, llvm::Function*,
bool, clang::CodeGen::CGBuilderTy&)
(/opt/compiler-explorer/clang-9.0.0/bin/clang-9+0x2a28599)
#13 0x0000561abef2370c
clang::CodeGen::CodeGenFunction::StartFunction(clang::GlobalDecl,
clang::QualType, llvm::Function*, clang::CodeGen::CGFunctionInfo const&,
clang::CodeGen::FunctionArgList const&, clang::SourceLocation,
clang::SourceLocation)
(/opt/compiler-explorer/clang-9.0.0/bin/clang-9+0x2a8c70c)
#14 0x0000561abef2701e
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/opt/compiler-explorer/clang-9.0.0/bin/clang-9+0x2a9001e)
#15 0x0000561abef64089
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/opt/compiler-explorer/clang-9.0.0/bin/clang-9+0x2acd089)
#16 0x0000561abef61f14
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/opt/compiler-explorer/clang-9.0.0/bin/clang-9+0x2acaf14)
#17 0x0000561abef67e2a clang::CodeGen::CodeGenModule::EmitDeferred()
(/opt/compiler-explorer/clang-9.0.0/bin/clang-9+0x2ad0e2a)
#18 0x0000561abef67f08 clang::CodeGen::CodeGenModule::Release()
(/opt/compiler-explorer/clang-9.0.0/bin/clang-9+0x2ad0f08)
#19 0x0000561abf9cad57 (anonymous
namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&)
(/opt/compiler-explorer/clang-9.0.0/bin/clang-9+0x3533d57)
#20 0x0000561abf9c9ccd
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/opt/compiler-explorer/clang-9.0.0/bin/clang-9+0x3532ccd)
#21 0x0000561ac019ce99 clang::ParseAST(clang::Sema&, bool, bool)
(/opt/compiler-explorer/clang-9.0.0/bin/clang-9+0x3d05e99)
#22 0x0000561abf9c7a47 clang::CodeGenAction::ExecuteAction()
(/opt/compiler-explorer/clang-9.0.0/bin/clang-9+0x3530a47)
#23 0x0000561abf343529 clang::FrontendAction::Execute()
(/opt/compiler-explorer/clang-9.0.0/bin/clang-9+0x2eac529)
#24 0x0000561abf306bf5
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/opt/compiler-explorer/clang-9.0.0/bin/clang-9+0x2e6fbf5)
#25 0x0000561abf406f23
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/opt/compiler-explorer/clang-9.0.0/bin/clang-9+0x2f6ff23)
#26 0x0000561abd1a5140 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/opt/compiler-explorer/clang-9.0.0/bin/clang-9+0xd0e140)
#27 0x0000561abd103882 main
(/opt/compiler-explorer/clang-9.0.0/bin/clang-9+0xc6c882)
#28 0x00007f284834c0b3 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x270b3)
#29 0x0000561abd1a27fa _start
(/opt/compiler-explorer/clang-9.0.0/bin/clang-9+0xd0b7fa)
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
```
Thanks
--
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/20201031/9a32bbed/attachment-0001.html>
More information about the llvm-bugs
mailing list