[llvm-bugs] [Bug 28106] New: clang crashes on C++ code with invalid destructor declaration: Assertion `!Ty.hasQualifiers() && "Destructor type must be unqualified"' failed

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jun 13 01:08:37 PDT 2016


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

            Bug ID: 28106
           Summary: clang crashes on C++ code with invalid destructor
                    declaration: Assertion `!Ty.hasQualifiers() &&
                    "Destructor type must be unqualified"' failed
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

The current clang trunk crashes when compiling the following C++ test case on
x86_64-linux-gnu in both 32-bit and 64-bit modes. 

This is a regression from 3.8.x.


$ clang++ -v
clang version 3.9.0 (trunk 272507)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$
$ clang++ -c small.cpp
clang-3.9:
/tmp/llvm-builder/llvm-source-trunk/tools/clang/lib/AST/DeclarationName.cpp:417:
clang::DeclarationName
clang::DeclarationNameTable::getCXXSpecialName(clang::DeclarationName::NameKind,
clang::CanQualType): Assertion `!Ty.hasQualifiers() && "Destructor type must be
unqualified"' failed.
#0 0x0000000001e23f35 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-3.9+0x1e23f35)
#1 0x0000000001e21dc6 llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-3.9+0x1e21dc6)
#2 0x0000000001e21fe4 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-3.9+0x1e21fe4)
#3 0x00007f3a308db340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007f3a2faf9cc9 gsignal
/build/eglibc-3GlaMS/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f3a2fafd0d8 abort
/build/eglibc-3GlaMS/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f3a2faf2b86 __assert_fail_base
/build/eglibc-3GlaMS/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f3a2faf2c32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x00000000033bdeaf
clang::DeclarationNameTable::getCXXSpecialName(clang::DeclarationName::NameKind,
clang::CanQual<clang::Type>) (/usr/local/clang-trunk/bin/clang-3.9+0x33bdeaf)
#9 0x0000000002f58fb4 clang::TreeTransform<(anonymous
namespace)::TemplateInstantiator>::TransformDeclarationNameInfo(clang::DeclarationNameInfo
const&) (/usr/local/clang-trunk/bin/clang-3.9+0x2f58fb4)
#10 0x0000000002f597c5
clang::Sema::SubstDeclarationNameInfo(clang::DeclarationNameInfo const&,
clang::MultiLevelTemplateArgumentList const&)
(/usr/local/clang-trunk/bin/clang-3.9+0x2f597c5)
#11 0x0000000002f8a5e6
clang::TemplateDeclInstantiator::VisitCXXMethodDecl(clang::CXXMethodDecl*,
clang::TemplateParameterList*, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x2f8a5e6)
#12 0x0000000002f55e92 clang::Sema::InstantiateClass(clang::SourceLocation,
clang::CXXRecordDecl*, clang::CXXRecordDecl*,
clang::MultiLevelTemplateArgumentList const&,
clang::TemplateSpecializationKind, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x2f55e92)
#13 0x0000000002f71aa4
clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation,
clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind,
bool) (/usr/local/clang-trunk/bin/clang-3.9+0x2f71aa4)
#14 0x0000000002faea7f
clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType,
clang::Sema::TypeDiagnoser*) (/usr/local/clang-trunk/bin/clang-3.9+0x2faea7f)
#15 0x0000000002faed45 clang::Sema::RequireCompleteType(clang::SourceLocation,
clang::QualType, clang::Sema::TypeDiagnoser&)
(/usr/local/clang-trunk/bin/clang-3.9+0x2faed45)
#16 0x0000000002faef23 clang::Sema::RequireCompleteType(clang::SourceLocation,
clang::QualType, unsigned int) (/usr/local/clang-trunk/bin/clang-3.9+0x2faef23)
#17 0x0000000002c0346f clang::Sema::ActOnUninitializedDecl(clang::Decl*, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x2c0346f)
#18 0x000000000294c5b6
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*)
(/usr/local/clang-trunk/bin/clang-3.9+0x294c5b6)
#19 0x000000000295a845 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
unsigned int, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/usr/local/clang-trunk/bin/clang-3.9+0x295a845)
#20 0x0000000002936ebd
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/usr/local/clang-trunk/bin/clang-3.9+0x2936ebd)
#21 0x0000000002937561
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) [clone .part.222]
(/usr/local/clang-trunk/bin/clang-3.9+0x2937561)
#22 0x000000000293759f
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
(/usr/local/clang-trunk/bin/clang-3.9+0x293759f)
#23 0x000000000293c350
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/usr/local/clang-trunk/bin/clang-3.9+0x293c350)
#24 0x000000000293cb20
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/local/clang-trunk/bin/clang-3.9+0x293cb20)
#25 0x00000000029340fb clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x29340fb)
#26 0x00000000025d01fe clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-3.9+0x25d01fe)
#27 0x000000000229a76e clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-3.9+0x229a76e)
#28 0x00000000022700e6
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-3.9+0x22700e6)
#29 0x00000000023284c2
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-3.9+0x23284c2)
#30 0x0000000000aeef38 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-3.9+0xaeef38)
#31 0x0000000000aa3134 main (/usr/local/clang-trunk/bin/clang-3.9+0xaa3134)
#32 0x00007f3a2fae4ec5 __libc_start_main
/build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:321:0
#33 0x0000000000aeafa4 _start (/usr/local/clang-trunk/bin/clang-3.9+0xaeafa4)
Stack dump:
0.      Program arguments: /usr/local/clang-trunk/bin/clang-3.9 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
small.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
-coverage-file /data2/small.cpp -resource-dir
/usr/local/clang-trunk/bin/../lib/clang/3.9.0 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/3.9.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 /data2 -ferror-limit 19 -fmessage-length 157
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o small.o -x c++ small.cpp
1.      small.cpp:7:18: current parser token ';'
2.      small.cpp:2:8: instantiating class definition 'A<const int>'
clang-3.9: error: unable to execute command: Aborted (core dumped)
clang-3.9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.9.0 (trunk 272507)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
clang-3.9: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang-3.9: note: diagnostic msg:
********************

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

********************
$


-------------------------------------


template < class T >
struct A
{ 
  ~T ();  // should be: ~A ();
};

A < const int > a;

-- 
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/20160613/49f1a556/attachment-0001.html>


More information about the llvm-bugs mailing list