[llvm-bugs] [Bug 43321] New: Segmentation fault in clang::NestedNameSpecifier::containsUnexpandedParameterPack

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Sep 15 07:55:07 PDT 2019


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

            Bug ID: 43321
           Summary: Segmentation fault in
                    clang::NestedNameSpecifier::containsUnexpandedParamete
                    rPack
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: simon at nikanor.nu
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

Created attachment 22500
  --> https://bugs.llvm.org/attachment.cgi?id=22500&action=edit
original source and run script

clang++ 8.0.1-3+b1 crashes on the attached piece of code. Also, both clang-tidy
8.0.1 and a build on llvm-svn: 371920 crashes as well, but in another function:
clang::Type::isDependentType with bogus this pointer 0x107030700070207.

See cfe-dev thread for more information:
http://lists.llvm.org/pipermail/cfe-dev/2019-September/063302.html

The source includes a libboost header (boost/asio.hpp), and with that the
preprocessed source is too large to attach (15MB, 1.8MB gzipped). So I will
only attach the original source file and the run script. The preprocessed
source is available here: http://simon.nikanor.nu/a-102587.cpp (and here:
http://simon.nikanor.nu/a-102587.cpp.gz )


Compile command: clang++-8 -Wall -Wextra -Werror -std=c++17 -pedantic -pthread
-g -o game_engine.cc.o -c a.cc


OS and package information:

Debian testing, Linux dev 5.2.8-dev #1 SMP Thu Aug 15 23:45:11 CEST 2019 x86_64
GNU/Linux
Package: clang-8
Version: 1:8.0.1-3+b1
Package: libclang-8-dev
Version: 1:8.0.1-3+b1
Package: libstdc++6
Version: 9.2.1-4
Package: libstdc++-9-dev
Version: 9.2.1-4
Package: libboost-all-dev
Version: 1.67.0.2


The crash does NOT occur with clang++-7 (7.0.1-9+b1).


- Simon

---

fatal error: too many errors emitted, stopping now [-ferror-limit=]
Stack dump:
0.      Program arguments: /usr/lib/llvm-8/bin/clang -cc1 -triple
x86_64-pc-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier
-discard-value-names -main-file-name a.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 -debug-info-kind=limited -dwarf-version=4
-debugger-tuning=gdb -coverage-notes-file /home/simon/tmp/game_engine.cc.gcno
-resource-dir /usr/lib/llvm-8/lib/clang/8.0.1 -internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/backward
-internal-isystem /usr/include/clang/8.0.1/include/ -internal-isystem
/usr/local/include -internal-isystem /usr/lib/llvm-8/lib/clang/8.0.1/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -Wall
-Wextra -Werror -pedantic -std=c++17 -fdeprecated-macro -fdebug-compilation-dir
/home/simon/tmp -ferror-limit 19 -fmessage-length 237 -pthread
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o game_engine.cc.o -x c++ /home/simon/tmp/a.cc -faddrsig
1.     
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_map.h:1439:46:
current parser token ';'
2.     
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/ostream:41:1:
parsing namespace 'std'
3.     
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_map.h:66:1:
parsing namespace 'std::std'
 #0 0x00007ff8eecf3f0f llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/lib/x86_64-linux-gnu/libLLVM-8.so.1+0xa9af0f)
 #1 0x00007ff8eecf2340 llvm::sys::RunSignalHandlers()
(/usr/lib/x86_64-linux-gnu/libLLVM-8.so.1+0xa99340)
 #2 0x00007ff8eecf4318 (/usr/lib/x86_64-linux-gnu/libLLVM-8.so.1+0xa9b318)
 #3 0x00007ff8f1f97510 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x13510)
 #4 0x0000000001a7da25
clang::NestedNameSpecifier::containsUnexpandedParameterPack() const
(/usr/lib/llvm-8/bin/clang+0x1a7da25)
 #5 0x00000000017bacb1
clang::Sema::DiagnoseUnexpandedParameterPack(clang::CXXScopeSpec const&,
clang::Sema::UnexpandedParameterPackContext)
(/usr/lib/llvm-8/bin/clang+0x17bacb1)
 #6 0x000000000139069e clang::Sema::HandleDeclarator(clang::Scope*,
clang::Declarator&, llvm::MutableArrayRef<clang::TemplateParameterList*>)
(/usr/lib/llvm-8/bin/clang+0x139069e)
 #7 0x0000000001390548 clang::Sema::ActOnDeclarator(clang::Scope*,
clang::Declarator&) (/usr/lib/llvm-8/bin/clang+0x1390548)
 #8 0x000000000120f460
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*)
(/usr/lib/llvm-8/bin/clang+0x120f460)
 #9 0x000000000120e1f0 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/usr/lib/llvm-8/bin/clang+0x120e1f0)
#10 0x00000000011f74ba
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/usr/lib/llvm-8/bin/clang+0x11f74ba)
#11 0x00000000011f6ee8
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
(/usr/lib/llvm-8/bin/clang+0x11f6ee8)
#12 0x00000000011f5e63
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/usr/lib/llvm-8/bin/clang+0x11f5e63)
#13 0x000000000121fb9a
clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo,
4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&,
clang::BalancedDelimiterTracker&) (/usr/lib/llvm-8/bin/clang+0x121fb9a)
#14 0x000000000121f777 clang::Parser::ParseNamespace(clang::DeclaratorContext,
clang::SourceLocation&, clang::SourceLocation)
(/usr/lib/llvm-8/bin/clang+0x121f777)
#15 0x0000000001209d54
clang::Parser::ParseDeclaration(clang::DeclaratorContext,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&)
(/usr/lib/llvm-8/bin/clang+0x1209d54)
#16 0x00000000011f5357
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/usr/lib/llvm-8/bin/clang+0x11f5357)
#17 0x000000000121fb9a
clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo,
4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&,
clang::BalancedDelimiterTracker&) (/usr/lib/llvm-8/bin/clang+0x121fb9a)
#18 0x000000000121f777 clang::Parser::ParseNamespace(clang::DeclaratorContext,
clang::SourceLocation&, clang::SourceLocation)
(/usr/lib/llvm-8/bin/clang+0x121f777)
#19 0x0000000001209d54
clang::Parser::ParseDeclaration(clang::DeclaratorContext,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&)
(/usr/lib/llvm-8/bin/clang+0x1209d54)
#20 0x00000000011f5357
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/usr/lib/llvm-8/bin/clang+0x11f5357)
#21 0x00000000011f4c78
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/lib/llvm-8/bin/clang+0x11f4c78)
#22 0x00000000011f06b6 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/lib/llvm-8/bin/clang+0x11f06b6)
#23 0x0000000000b0545f clang::FrontendAction::Execute()
(/usr/lib/llvm-8/bin/clang+0xb0545f)
#24 0x0000000000ac3168
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/lib/llvm-8/bin/clang+0xac3168)
#25 0x0000000000b8a936
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/lib/llvm-8/bin/clang+0xb8a936)
#26 0x00000000006d053a cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/lib/llvm-8/bin/clang+0x6d053a)
#27 0x00000000006cea36 main (/usr/lib/llvm-8/bin/clang+0x6cea36)
#28 0x00007ff8edd88bbb __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x26bbb)
#29 0x00000000006cc12a _start (/usr/lib/llvm-8/bin/clang+0x6cc12a)
clang: error: unable to execute command: Segmentation fault
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 8.0.1-3+b1 (tags/RELEASE_801/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang: note: diagnostic msg:
********************

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

********************

-- 
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/20190915/dca8c1c3/attachment.html>


More information about the llvm-bugs mailing list