[llvm-bugs] [Bug 51142] New: Compiler crashes processing incorrect suffix operator

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 20 00:39:06 PDT 2021


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

            Bug ID: 51142
           Summary: Compiler crashes processing incorrect suffix operator
           Product: clang
           Version: 12.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: fchelnokov at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Compiler crash when processing
```
template<typename T>
constexpr auto operator ""_l();

```
https://gcc.godbolt.org/z/KnehEKdfb

PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /opt/compiler-explorer/clang-12.0.1/bin/clang++ -g
-o /app/output.s -mllvm --x86-asm-syntax=intel -S
--gcc-toolchain=/opt/compiler-explorer/gcc-11.1.0 -fcolor-diagnostics
-fno-crash-diagnostics -std=c++20 -Wall -Wextra -pedantic-errors <source>
1.      <source>:2:31: current parser token ';'
 #0 0x000055ee1fddf61c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x300b61c)
 #1 0x000055ee1fddd3c4 llvm::sys::RunSignalHandlers()
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x30093c4)
 #2 0x000055ee1fddd645 llvm::sys::CleanupOnSignal(unsigned long)
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x3009645)
 #3 0x000055ee1fd45f18 CrashRecoverySignalHandler(int)
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x2f71f18)
 #4 0x00007f9f49ef23c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
 #5 0x000055ee224d6990 clang::Decl::isTemplateParameterPack() const
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x5702990)
 #6 0x000055ee21cca28e
clang::Sema::CheckLiteralOperatorDeclaration(clang::FunctionDecl*)
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x4ef628e)
 #7 0x000055ee21c5c196 clang::Sema::CheckFunctionDeclaration(clang::Scope*,
clang::FunctionDecl*, clang::LookupResult&, bool)
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x4e88196)
 #8 0x000055ee21c62e7a clang::Sema::ActOnFunctionDeclarator(clang::Scope*,
clang::Declarator&, clang::DeclContext*, clang::TypeSourceInfo*,
clang::LookupResult&, llvm::MutableArrayRef<clang::TemplateParameterList*>,
bool&) (/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x4e8ee7a)
 #9 0x000055ee21c6661f clang::Sema::HandleDeclarator(clang::Scope*,
clang::Declarator&, llvm::MutableArrayRef<clang::TemplateParameterList*>)
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x4e9261f)
#10 0x000055ee2207646a clang::Sema::ActOnTemplateDeclarator(clang::Scope*,
llvm::MutableArrayRef<clang::TemplateParameterList*>, clang::Declarator&)
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x52a246a)
#11 0x000055ee21a0e3f1
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*)
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x4c3a3f1)
#12 0x000055ee21abd0f6
clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext,
clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x4ce90f6)
#13 0x000055ee21ac0973
clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x4cec973)
#14 0x000055ee21ac0ee4
clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x4cecee4)
#15 0x000055ee21a20355
clang::Parser::ParseDeclaration(clang::DeclaratorContext,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&,
clang::SourceLocation*)
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x4c4c355)
#16 0x000055ee219f8b2b
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x4c24b2b)
#17 0x000055ee219fa089
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x4c26089)
#18 0x000055ee219fa675
clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x4c26675)
#19 0x000055ee219ed2b3 clang::ParseAST(clang::Sema&, bool, bool)
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x4c192b3)
#20 0x000055ee20c2d0b2 clang::CodeGenAction::ExecuteAction()
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x3e590b2)
#21 0x000055ee20633ee1 clang::FrontendAction::Execute()
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x385fee1)
#22 0x000055ee205da2e3
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x38062e3)
#23 0x000055ee206fc0b3
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x39280b3)
#24 0x000055ee1dda571c cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/opt/compiler-explorer/clang-12.0.1/bin/clang+++0xfd171c)
#25 0x000055ee1dda1c9d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0xfcdc9d)
#26 0x000055ee2049bf65 void llvm::function_ref<void
()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const::'lambda'()>(long)
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x36c7f65)
#27 0x000055ee1fd45ff3
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x2f71ff3)
#28 0x000055ee2049cab8
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const (.part.174)
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x36c8ab8)
#29 0x000055ee2047560a
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x36a160a)
#30 0x000055ee2047615f
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x36a215f)
#31 0x000055ee2047ef65
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0x36aaf65)
#32 0x000055ee1dcce1cc main
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0xefa1cc)
#33 0x00007f9f499a20b3 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x270b3)
#34 0x000055ee1dda181a _start
(/opt/compiler-explorer/clang-12.0.1/bin/clang+++0xfcd81a)
clang-12: error: clang frontend command failed with exit code 139 (use -v to
see invocation)
ASM generation compiler returned: 139
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /opt/compiler-explorer/clang-12.0.1/bin/clang-12
-cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all
--mrelax-relocations -disable-free -disable-llvm-verifier -discard-value-names
-main-file-name example.cpp -mrelocation-model static -mframe-pointer=all
-fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables
-target-cpu x86-64 -tune-cpu generic -fno-split-dwarf-inlining
-debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -resource-dir
/opt/compiler-explorer/clang-12.0.1/lib/clang/12.0.1 -internal-isystem
/opt/compiler-explorer/gcc-11.1.0/lib/gcc/x86_64-linux-gnu/11.1.0/../../../../include/c++/11.1.0
-internal-isystem
/opt/compiler-explorer/gcc-11.1.0/lib/gcc/x86_64-linux-gnu/11.1.0/../../../../include/c++/11.1.0/x86_64-linux-gnu
-internal-isystem
/opt/compiler-explorer/gcc-11.1.0/lib/gcc/x86_64-linux-gnu/11.1.0/../../../../include/c++/11.1.0/backward
-internal-isystem /usr/local/include -internal-isystem
/opt/compiler-explorer/clang-12.0.1/lib/clang/12.0.1/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -Wall
-Wextra -pedantic-errors -std=c++20 -fdeprecated-macro -fdebug-compilation-dir
/app -ferror-limit 19 -fgnuc-version=4.2.1 -fno-implicit-modules
-fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -o
/tmp/example-c3d7df.o -x c++ <source>
1.      <source>:2:31: current parser token ';'
 #0 0x0000558979f4c61c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/opt/compiler-explorer/clang-12.0.1/bin/clang-12+0x300b61c)
 #1 0x0000558979f4a3c4 llvm::sys::RunSignalHandlers()
(/opt/compiler-explorer/clang-12.0.1/bin/clang-12+0x30093c4)
 #2 0x0000558979f4a533 SignalHandler(int)
(/opt/compiler-explorer/clang-12.0.1/bin/clang-12+0x3009533)
 #3 0x00007efd4207a3c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
 #4 0x000055897c643990 clang::Decl::isTemplateParameterPack() const
(/opt/compiler-explorer/clang-12.0.1/bin/clang-12+0x5702990)
 #5 0x000055897be3728e
clang::Sema::CheckLiteralOperatorDeclaration(clang::FunctionDecl*)
(/opt/compiler-explorer/clang-12.0.1/bin/clang-12+0x4ef628e)
 #6 0x000055897bdc9196 clang::Sema::CheckFunctionDeclaration(clang::Scope*,
clang::FunctionDecl*, clang::LookupResult&, bool)
(/opt/compiler-explorer/clang-12.0.1/bin/clang-12+0x4e88196)
 #7 0x000055897bdcfe7a clang::Sema::ActOnFunctionDeclarator(clang::Scope*,
clang::Declarator&, clang::DeclContext*, clang::TypeSourceInfo*,
clang::LookupResult&, llvm::MutableArrayRef<clang::TemplateParameterList*>,
bool&) (/opt/compiler-explorer/clang-12.0.1/bin/clang-12+0x4e8ee7a)
 #8 0x000055897bdd361f clang::Sema::HandleDeclarator(clang::Scope*,
clang::Declarator&, llvm::MutableArrayRef<clang::TemplateParameterList*>)
(/opt/compiler-explorer/clang-12.0.1/bin/clang-12+0x4e9261f)
 #9 0x000055897c1e346a clang::Sema::ActOnTemplateDeclarator(clang::Scope*,
llvm::MutableArrayRef<clang::TemplateParameterList*>, clang::Declarator&)
(/opt/compiler-explorer/clang-12.0.1/bin/clang-12+0x52a246a)
#10 0x000055897bb7b3f1
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*)
(/opt/compiler-explorer/clang-12.0.1/bin/clang-12+0x4c3a3f1)
#11 0x000055897bc2a0f6
clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext,
clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
(/opt/compiler-explorer/clang-12.0.1/bin/clang-12+0x4ce90f6)
#12 0x000055897bc2d973
clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
(/opt/compiler-explorer/clang-12.0.1/bin/clang-12+0x4cec973)
#13 0x000055897bc2dee4
clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
(/opt/compiler-explorer/clang-12.0.1/bin/clang-12+0x4cecee4)
#14 0x000055897bb8d355
clang::Parser::ParseDeclaration(clang::DeclaratorContext,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&,
clang::SourceLocation*)
(/opt/compiler-explorer/clang-12.0.1/bin/clang-12+0x4c4c355)
#15 0x000055897bb65b2b
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
(/opt/compiler-explorer/clang-12.0.1/bin/clang-12+0x4c24b2b)
#16 0x000055897bb67089
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/opt/compiler-explorer/clang-12.0.1/bin/clang-12+0x4c26089)
#17 0x000055897bb67675
clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/opt/compiler-explorer/clang-12.0.1/bin/clang-12+0x4c26675)
#18 0x000055897bb5a2b3 clang::ParseAST(clang::Sema&, bool, bool)
(/opt/compiler-explorer/clang-12.0.1/bin/clang-12+0x4c192b3)
#19 0x000055897ad9a0b2 clang::CodeGenAction::ExecuteAction()
(/opt/compiler-explorer/clang-12.0.1/bin/clang-12+0x3e590b2)
#20 0x000055897a7a0ee1 clang::FrontendAction::Execute()
(/opt/compiler-explorer/clang-12.0.1/bin/clang-12+0x385fee1)
#21 0x000055897a7472e3
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/opt/compiler-explorer/clang-12.0.1/bin/clang-12+0x38062e3)
#22 0x000055897a8690b3
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/opt/compiler-explorer/clang-12.0.1/bin/clang-12+0x39280b3)
#23 0x0000558977f1271c cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/opt/compiler-explorer/clang-12.0.1/bin/clang-12+0xfd171c)
#24 0x0000558977f0ec9d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/opt/compiler-explorer/clang-12.0.1/bin/clang-12+0xfcdc9d)
#25 0x0000558977e3a212 main
(/opt/compiler-explorer/clang-12.0.1/bin/clang-12+0xef9212)
#26 0x00007efd41b2a0b3 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x270b3)
#27 0x0000558977f0e81a _start
(/opt/compiler-explorer/clang-12.0.1/bin/clang-12+0xfcd81a)
clang-12: error: unable to execute command: Segmentation fault (core dumped)
clang-12: error: clang frontend command failed due to signal (use -v to see
invocation)
Execution build 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/20210720/dda12156/attachment-0001.html>


More information about the llvm-bugs mailing list