[llvm-bugs] [Bug 44361] New: Crash in clang::Redeclarable<clang::TagDecl>::DeclLink::getPrevious(clang::TagDecl const*)

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Dec 21 10:39:18 PST 2019


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

            Bug ID: 44361
           Summary: Crash in
                    clang::Redeclarable<clang::TagDecl>::DeclLink::getPrev
                    ious(clang::TagDecl const*)
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rmansfield 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

clang crashes on the following invalid C++

$ cat ~/ice.ii
template <typename> class a {
  template<typename b>
    class :: c : b
      virtual
      ~c(}} template class c< char >;

$ ./bin/clang --version
clang version 10.0.0 (https://github.com/llvm/llvm-project.git
6945d383b9e8ca1b38442f06726d770676fe5856)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/ryan_mansfield/llvm/llvm-project/build/./bin

$ ./bin/clang ~/ice.ii
/home/ryan_mansfield/ice.ii:3:14: error: non-friend class member 'c' cannot
have a qualified name
    class :: c : b
          ~~ ^
/home/ryan_mansfield/ice.ii:3:14: error: out-of-line definition of 'c' does not
match any declaration in the global namespace
    class :: c : b
          ~~ ^
/home/ryan_mansfield/ice.ii:3:19: error: expected '{' after base class list
    class :: c : b
                  ^
                   {
/home/ryan_mansfield/ice.ii:5:10: error: expected parameter declarator
      ~c(}} template class c< char >;
         ^
/home/ryan_mansfield/ice.ii:5:10: error: expected ')'
/home/ryan_mansfield/ice.ii:5:9: note: to match this '('
      ~c(}} template class c< char >;
        ^
/home/ryan_mansfield/ice.ii:5:10: error: expected ';' at end of declaration
list
      ~c(}} template class c< char >;
         ^
         ;
/home/ryan_mansfield/ice.ii:5:11: error: expected ';' after class
      ~c(}} template class c< char >;
          ^
          ;
/home/ryan_mansfield/ice.ii:5:12: error: expected ';' after class
      ~c(}} template class c< char >;
           ^
           ;
Stack dump:
0.      Program arguments:
/home/ryan_mansfield/llvm/llvm-project/build/bin/clang-10 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -discard-value-names -main-file-name ice.ii
-mrelocation-model static -mthread-model posix -mframe-pointer=all -fmath-errno
-fno-rounding-math -masm-verbose -mconstructor-aliases -munwind-tables
-target-cpu x86-64 -dwarf-column-info -fno-split-dwarf-inlining
-debugger-tuning=gdb -resource-dir
/home/ryan_mansfield/llvm/llvm-project/build/lib/clang/10.0.0
-fdeprecated-macro -fdebug-compilation-dir
/home/ryan_mansfield/llvm/llvm-project/build -ferror-limit 19 -fmessage-length
0 -fgnuc-version=4.2.1 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -faddrsig -o /tmp/ice-ee3e32.o -x
c++-cpp-output /home/ryan_mansfield/ice.ii 
1.      /home/ryan_mansfield/ice.ii:5:37: current parser token ';'
2.      /home/ryan_mansfield/ice.ii:5:28: instantiating class definition
'c<char>'
 #0 0x0000563f1f098d4a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/ryan_mansfield/llvm/llvm-project/build/bin/clang-10+0x1cedd4a)
 #1 0x0000563f1f096a34 llvm::sys::RunSignalHandlers()
(/home/ryan_mansfield/llvm/llvm-project/build/bin/clang-10+0x1ceba34)
 #2 0x0000563f1f096b83 SignalHandler(int)
(/home/ryan_mansfield/llvm/llvm-project/build/bin/clang-10+0x1cebb83)
 #3 0x00007f5f9eaa9890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #4 0x0000563f1f2c70ab
clang::Redeclarable<clang::TagDecl>::DeclLink::getPrevious(clang::TagDecl
const*) const
(/home/ryan_mansfield/llvm/llvm-project/build/bin/clang-10+0x1f1c0ab)
 #5 0x0000563f211529d7 clang::CXXRecordDecl::mayBeAbstract() const
(/home/ryan_mansfield/llvm/llvm-project/build/bin/clang-10+0x3da79d7)
 #6 0x0000563f21153661
clang::CXXRecordDecl::completeDefinition(clang::CXXFinalOverriderMap*)
(/home/ryan_mansfield/llvm/llvm-project/build/bin/clang-10+0x3da8661)
 #7 0x0000563f209ea2fb clang::Sema::ActOnFields(clang::Scope*,
clang::SourceLocation, clang::Decl*, llvm::ArrayRef<clang::Decl*>,
clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributesView
const&) (/home/ryan_mansfield/llvm/llvm-project/build/bin/clang-10+0x363f2fb)
 #8 0x0000563f20e9bfff clang::Sema::InstantiateClass(clang::SourceLocation,
clang::CXXRecordDecl*, clang::CXXRecordDecl*,
clang::MultiLevelTemplateArgumentList const&,
clang::TemplateSpecializationKind, bool)
(/home/ryan_mansfield/llvm/llvm-project/build/bin/clang-10+0x3af0fff)
 #9 0x0000563f20eaf3cf
clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation,
clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind,
bool) (/home/ryan_mansfield/llvm/llvm-project/build/bin/clang-10+0x3b043cf)
#10 0x0000563f20de22c2 clang::Sema::ActOnExplicitInstantiation(clang::Scope*,
clang::SourceLocation, clang::SourceLocation, unsigned int,
clang::SourceLocation, clang::CXXScopeSpec const&,
clang::OpaquePtr<clang::TemplateName>, clang::SourceLocation,
clang::SourceLocation, llvm::MutableArrayRef<clang::ParsedTemplateArgument>,
clang::SourceLocation, clang::ParsedAttributesView const&)
(/home/ryan_mansfield/llvm/llvm-project/build/bin/clang-10+0x3a372c2)
#11 0x0000563f2085320b
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&)
(/home/ryan_mansfield/llvm/llvm-project/build/bin/clang-10+0x34a820b)
#12 0x0000563f2082e67c
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*)
(/home/ryan_mansfield/llvm/llvm-project/build/bin/clang-10+0x348367c)
#13 0x0000563f208bb7b7
clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext,
clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
(/home/ryan_mansfield/llvm/llvm-project/build/bin/clang-10+0x35107b7)
#14 0x0000563f208be436
clang::Parser::ParseExplicitInstantiation(clang::DeclaratorContext,
clang::SourceLocation, clang::SourceLocation, clang::SourceLocation&,
clang::ParsedAttributes&, clang::AccessSpecifier)
(/home/ryan_mansfield/llvm/llvm-project/build/bin/clang-10+0x3513436)
#15 0x0000563f208be5c8
clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
(/home/ryan_mansfield/llvm/llvm-project/build/bin/clang-10+0x35135c8)
#16 0x0000563f2083c455
clang::Parser::ParseDeclaration(clang::DeclaratorContext,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&,
clang::SourceLocation*)
(/home/ryan_mansfield/llvm/llvm-project/build/bin/clang-10+0x3491455)
#17 0x0000563f20818c0d
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
(/home/ryan_mansfield/llvm/llvm-project/build/bin/clang-10+0x346dc0d)
#18 0x0000563f2081a229
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/home/ryan_mansfield/llvm/llvm-project/build/bin/clang-10+0x346f229)
#19 0x0000563f2080df59 clang::ParseAST(clang::Sema&, bool, bool)
(/home/ryan_mansfield/llvm/llvm-project/build/bin/clang-10+0x3462f59)
#20 0x0000563f1f7dbbf9 clang::FrontendAction::Execute()
(/home/ryan_mansfield/llvm/llvm-project/build/bin/clang-10+0x2430bf9)
#21 0x0000563f1f79b4ea
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/ryan_mansfield/llvm/llvm-project/build/bin/clang-10+0x23f04ea)
#22 0x0000563f1f8a3c3b
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/ryan_mansfield/llvm/llvm-project/build/bin/clang-10+0x24f8c3b)
#23 0x0000563f1de120ed cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/ryan_mansfield/llvm/llvm-project/build/bin/clang-10+0xa670ed)
#24 0x0000563f1dd9e73c main
(/home/ryan_mansfield/llvm/llvm-project/build/bin/clang-10+0x9f373c)
#25 0x00007f5f9d73db97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#26 0x0000563f1de0f16a _start
(/home/ryan_mansfield/llvm/llvm-project/build/bin/clang-10+0xa6416a)
clang-10: error: unable to execute command: Segmentation fault (core dumped)
clang-10: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 10.0.0 (https://github.com/llvm/llvm-project.git
6945d383b9e8ca1b38442f06726d770676fe5856)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/ryan_mansfield/llvm/llvm-project/build/./bin
clang-10: 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-10: note: diagnostic msg: Error generating preprocessed source(s) - no
preprocessable inputs.

-- 
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/20191221/fc1ed90f/attachment-0001.html>


More information about the llvm-bugs mailing list