[llvm-bugs] [Bug 41400] New: Segmentation fault on incorrect using directive

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Apr 5 13:38:57 PDT 2019


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

            Bug ID: 41400
           Summary: Segmentation fault on incorrect using directive
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: coillol at yandex.ru
                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

Clang starting from version 7.0.0 (as tested on godbolt) crashes with
segmentation fault when processing the following incorrect code (minimized
input):

template<class> class S { using S

Compiling it with clang 8.0.0:

$ clang++ crash.cpp

gives this stack trace:

Stack dump:
0.      Program arguments: /usr/local/clang-8.0.0/bin/clang-8 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -discard-value-names -main-file-name crash.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 -debugger-tuning=gdb -resource-dir
/usr/local/clang-8.0.0/lib/clang/8.0.0 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/local/clang-8.0.0/lib/clang/8.0.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -fdeprecated-macro
-fdebug-compilation-dir /home/mygrain/compiler_research/Templates -ferror-limit
19 -fmessage-length 212 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/crash-276b5d.o -x c++
crash.cpp -faddrsig 
1.      <eof> parser at end of file
2.      crash.cpp:1:17: parsing struct/union/class body 'S'
 #0 0x00000000015d8e5a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-8.0.0/bin/clang-8+0x15d8e5a)
 #1 0x00000000015d6dec llvm::sys::RunSignalHandlers()
(/usr/local/clang-8.0.0/bin/clang-8+0x15d6dec)
 #2 0x00000000015d6f57 SignalHandler(int)
(/usr/local/clang-8.0.0/bin/clang-8+0x15d6f57)
 #3 0x00007f4e1d2af390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
 #4 0x00000000031631c0 clang::NestedNameSpecifier::getKind() const
(/usr/local/clang-8.0.0/bin/clang-8+0x31631c0)
 #5 0x0000000003163966
clang::NestedNameSpecifier::containsUnexpandedParameterPack() const
(/usr/local/clang-8.0.0/bin/clang-8+0x3163966)
 #6 0x0000000002fcf3e4
clang::ASTContext::getDependentNameType(clang::ElaboratedTypeKeyword,
clang::NestedNameSpecifier*, clang::IdentifierInfo const*, clang::QualType)
const (/usr/local/clang-8.0.0/bin/clang-8+0x2fcf3e4)
 #7 0x0000000002c56885 clang::Sema::getConstructorName(clang::IdentifierInfo&,
clang::SourceLocation, clang::Scope*, clang::CXXScopeSpec&, bool)
(/usr/local/clang-8.0.0/bin/clang-8+0x2c56885)
 #8 0x000000000295ff13 clang::Parser::ParseUnqualifiedId(clang::CXXScopeSpec&,
bool, bool, bool, bool, clang::OpaquePtr<clang::QualType>,
clang::SourceLocation*, clang::UnqualifiedId&)
(/usr/local/clang-8.0.0/bin/clang-8+0x295ff13)
 #9 0x0000000002935e01
clang::Parser::ParseUsingDeclarator(clang::DeclaratorContext,
clang::Parser::UsingDeclarator&) (/usr/local/clang-8.0.0/bin/clang-8+0x2935e01)
#10 0x0000000002941e82
clang::Parser::ParseUsingDeclaration(clang::DeclaratorContext,
clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation,
clang::SourceLocation&, clang::AccessSpecifier)
(/usr/local/clang-8.0.0/bin/clang-8+0x2941e82)
#11 0x0000000002943c4b
clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier,
clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo const&,
clang::ParsingDeclRAIIObject*) (/usr/local/clang-8.0.0/bin/clang-8+0x2943c4b)
#12 0x00000000029454b5
clang::Parser::ParseCXXClassMemberDeclarationWithPragmas(clang::AccessSpecifier&,
clang::Parser::ParsedAttributesWithRange&, clang::TypeSpecifierType,
clang::Decl*) (/usr/local/clang-8.0.0/bin/clang-8+0x29454b5)
#13 0x0000000002945ddf
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int,
clang::Decl*) (/usr/local/clang-8.0.0/bin/clang-8+0x2945ddf)
#14 0x000000000294837b
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&)
(/usr/local/clang-8.0.0/bin/clang-8+0x294837b)
#15 0x000000000292b7a9
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*)
(/usr/local/clang-8.0.0/bin/clang-8+0x292b7a9)
#16 0x00000000029aa6a6
clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext,
clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
(/usr/local/clang-8.0.0/bin/clang-8+0x29aa6a6)
#17 0x00000000029acf9a
clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
(/usr/local/clang-8.0.0/bin/clang-8+0x29acf9a)
#18 0x00000000029ad2cf
clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
(/usr/local/clang-8.0.0/bin/clang-8+0x29ad2cf)
#19 0x000000000292f0a6
clang::Parser::ParseDeclaration(clang::DeclaratorContext,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&)
(/usr/local/clang-8.0.0/bin/clang-8+0x292f0a6)
#20 0x000000000290b78c
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/usr/local/clang-8.0.0/bin/clang-8+0x290b78c)
#21 0x000000000290c94e
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/local/clang-8.0.0/bin/clang-8+0x290c94e)
#22 0x000000000290cbf0
clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/local/clang-8.0.0/bin/clang-8+0x290cbf0)
#23 0x0000000002903528 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-8.0.0/bin/clang-8+0x2903528)
#24 0x0000000002046637 clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-8.0.0/bin/clang-8+0x2046637)
#25 0x0000000001be5706 clang::FrontendAction::Execute()
(/usr/local/clang-8.0.0/bin/clang-8+0x1be5706)
#26 0x0000000001babd0e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-8.0.0/bin/clang-8+0x1babd0e)
#27 0x0000000001c80edc
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-8.0.0/bin/clang-8+0x1c80edc)
#28 0x00000000008ec228 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-8.0.0/bin/clang-8+0x8ec228)
#29 0x000000000087ef9c main (/usr/local/clang-8.0.0/bin/clang-8+0x87ef9c)
#30 0x00007f4e1c235830 __libc_start_main
/build/glibc-LK5gWL/glibc-2.23/csu/../csu/libc-start.c:325:0
#31 0x00000000008e9939 _start (/usr/local/clang-8.0.0/bin/clang-8+0x8e9939)
clang-8: error: unable to execute command: Segmentation fault (core dumped)
clang-8: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 8.0.0 
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-8.0.0/bin
clang-8: 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-8: note: diagnostic msg: 
********************

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

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

Compiler fails with any -std option.

-- 
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/20190405/03b6b5e8/attachment-0001.html>


More information about the llvm-bugs mailing list