Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

ICE on unsupported TypeLoc kind in declarator #46171

Open Quuxplusone opened 4 years ago

Quuxplusone commented 4 years ago
Bugzilla Link PR47202
Status CONFIRMED
Importance P enhancement
Reported by Yixuan Tang (tangyixuan@mail.dlut.edu.cn)
Reported on 2020-08-17 04:04:40 -0700
Last modified on 2020-09-23 19:33:27 -0700
Version trunk
Hardware PC Linux
CC blitzrakete@gmail.com, dblaikie@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
The following valid code triggers an ICE for clang 10, while g++ compiles
sucessfully:

$:cat s.cpp

template<typename T> struct A
{
  int a[sizeof(T)] __attribute((vector_size(2)));
};

$:clang++ a -c s.cpp

unsupported TypeLoc kind in declarator!
UNREACHABLE executed at /home/oscar/compiler/llvm-
project/clang/lib/Sema/SemaType.cpp:5716!
Stack dump:
0.  Program arguments: /usr/local/bin/clang-9 -cc1 -triple x86_64-unknown-linux-
gnu -emit-obj -mrelax-all -disable-free -main-file-name 34913.C -mrelocation-
model static -mthread-model posix -mframe-pointer=all -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/lib/clang/10.0.0 -internal-isystem /usr/local/bin/../lib/gcc/x86_64-
pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0 -internal-isystem
/usr/local/bin/../lib/gcc/x86_64-pc-linux-
gnu/9.2.0/../../../../include/c++/9.2.0/x86_64-pc-linux-gnu -internal-isystem
/usr/local/bin/../lib/gcc/x86_64-pc-linux-
gnu/9.2.0/../../../../include/c++/9.2.0/backward -internal-isystem
/usr/local/include -internal-isystem /usr/local/lib/clang/10.0.0/include -
internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-
isystem /include -internal-externc-isystem /usr/include -std=c++11 -fdeprecated-
macro -fdebug-compilation-dir /media/oscar/xuaner1/c++bugreprot/TEST-CRASH -
ferror-limit 19 -fmessage-length 0 -fgnuc-version=4.2.1 -fobjc-runtime=gcc -
fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -
faddrsig -o 34913.o -x c++ 34913.C
1.  34913.C:15:49: current parser token ';'
2.  34913.C:13:22: parsing struct/union/class body 'A'
 #0 0x0000556afa4d705f llvm::sys::PrintStackTrace(llvm::raw_ostream&) /home/oscar/compiler/llvm-project/llvm/lib/Support/Unix/Signals.inc:544:0
 #1 0x0000556afa4d70f2 PrintStackTraceSignalHandler(void*) /home/oscar/compiler/llvm-project/llvm/lib/Support/Unix/Signals.inc:605:0
 #2 0x0000556afa4d4f55 llvm::sys::RunSignalHandlers() /home/oscar/compiler/llvm-project/llvm/lib/Support/Signals.cpp:68:0
 #3 0x0000556afa4d69ea SignalHandler(int) /home/oscar/compiler/llvm-project/llvm/lib/Support/Unix/Signals.inc:391:0
 #4 0x00007f9b403e58a0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x128a0)
 #5 0x00007f9b3f4ddf47 raise (/lib/x86_64-linux-gnu/libc.so.6+0x3ef47)
 #6 0x00007f9b3f4df8b1 abort (/lib/x86_64-linux-gnu/libc.so.6+0x408b1)
 #7 0x0000556afa4172a8 bindingsErrorHandler(void*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) /home/oscar/compiler/llvm-project/llvm/lib/Support/ErrorHandling.cpp:218:0
 #8 0x0000556afdad3207 fillAtomicQualLoc(clang::AtomicTypeLoc, clang::DeclaratorChunk const&) /home/oscar/compiler/llvm-project/clang/lib/Sema/SemaType.cpp:5721:0
 #9 0x0000556afdae0665 clang::TypeLocVisitor<(anonymous namespace)::DeclaratorLocFiller, void>::VisitDependentVectorTypeLoc(clang::DependentVectorTypeLoc) /home/oscar/compiler/llvm-project/build/tools/clang/include/clang/AST/TypeNodes.inc:39:0
#10 0x0000556afdadec1b clang::TypeLocVisitor<(anonymous
namespace)::DeclaratorLocFiller, void>::Visit(clang::UnqualTypeLoc)
/home/oscar/compiler/llvm-project/build/tools/clang/include/clang/AST/TypeNodes.inc:39:0
#11 0x0000556afdad37c7 GetTypeSourceInfoForDeclarator((anonymous
namespace)::TypeProcessingState&, clang::QualType, clang::TypeSourceInfo*)
/home/oscar/compiler/llvm-project/clang/lib/Sema/SemaType.cpp:5814:0
#12 0x0000556afdad1098 GetFullTypeForDeclarator((anonymous
namespace)::TypeProcessingState&, clang::QualType, clang::TypeSourceInfo*)
/home/oscar/compiler/llvm-project/clang/lib/Sema/SemaType.cpp:5278:0
#13 0x0000556afdad11a9 clang::Sema::GetTypeForDeclarator(clang::Declarator&,
clang::Scope*) /home/oscar/compiler/llvm-
project/clang/lib/Sema/SemaType.cpp:5296:0
#14 0x0000556afd13832c clang::Sema::HandleField(clang::Scope*,
clang::RecordDecl*, clang::SourceLocation, clang::Declarator&, clang::Expr*,
clang::InClassInitStyle, clang::AccessSpecifier) /home/oscar/compiler/llvm-
project/clang/lib/Sema/SemaDecl.cpp:15909:0
#15 0x0000556afd310c6d clang::Sema::ActOnCXXMemberDeclarator(clang::Scope*,
clang::AccessSpecifier, clang::Declarator&,
llvm::MutableArrayRef<clang::TemplateParameterList*>, clang::Expr*,
clang::VirtSpecifiers const&, clang::InClassInitStyle)
/home/oscar/compiler/llvm-project/clang/lib/Sema/SemaDeclCXX.cpp:3340:0
#16 0x0000556afced6689
clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier,
clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo const&,
clang::ParsingDeclRAIIObject*) /home/oscar/compiler/llvm-
project/clang/lib/Parse/ParseDeclCXX.cpp:2806:0
#17 0x0000556afced7dec
clang::Parser::ParseCXXClassMemberDeclarationWithPragmas(clang::AccessSpecifier&,
clang::Parser::ParsedAttributesWithRange&, clang::TypeSpecifierType,
clang::Decl*) /home/oscar/compiler/llvm-
project/clang/lib/Parse/ParseDeclCXX.cpp:3146:0
#18 0x0000556afced89b9
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int,
clang::Decl*) /home/oscar/compiler/llvm-
project/clang/lib/Parse/ParseDeclCXX.cpp:3323:0
#19 0x0000556afced3088
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&) /home/oscar/compiler/llvm-
project/clang/lib/Parse/ParseDeclCXX.cpp:1956:0
#20 0x0000556afceb5360
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*)
/home/oscar/compiler/llvm-project/clang/lib/Parse/ParseDecl.cpp:3854:0
#21 0x0000556afcf62ba6
clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext,
clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
/home/oscar/compiler/llvm-project/clang/lib/Parse/ParseTemplate.cpp:216:0
#22 0x0000556afcf627d6
clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
/home/oscar/compiler/llvm-project/clang/lib/Parse/ParseTemplate.cpp:163:0
#23 0x0000556afcf62243
clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
/home/oscar/compiler/llvm-project/clang/lib/Parse/ParseTemplate.cpp:36:0
#24 0x0000556afcead544
clang::Parser::ParseDeclaration(clang::DeclaratorContext,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&,
clang::SourceLocation*) /home/oscar/compiler/llvm-
project/clang/lib/Parse/ParseDecl.cpp:1758:0
#25 0x0000556afce8f6e7
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) /home/oscar/compiler/llvm-
project/clang/lib/Parse/Parser.cpp:864:0
#26 0x0000556afce8ed5c
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
/home/oscar/compiler/llvm-project/clang/lib/Parse/Parser.cpp:682:0
#27 0x0000556afce8e7f7
clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
/home/oscar/compiler/llvm-project/clang/lib/Parse/Parser.cpp:560:0
#28 0x0000556afce8aade clang::ParseAST(clang::Sema&, bool, bool)
/home/oscar/compiler/llvm-project/clang/lib/Parse/ParseAST.cpp:157:0
#29 0x0000556afaf5a33b clang::ASTFrontendAction::ExecuteAction()
/home/oscar/compiler/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1042:0
#30 0x0000556afb803be2 clang::CodeGenAction::ExecuteAction()
/home/oscar/compiler/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:1089:0
#31 0x0000556afaf59c9c clang::FrontendAction::Execute()
/home/oscar/compiler/llvm-project/clang/lib/Frontend/FrontendAction.cpp:939:0
#32 0x0000556afaef1f17
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/home/oscar/compiler/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:956:0
#33 0x0000556afb0c1a9b
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/home/oscar/compiler/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:290:0
#34 0x0000556af7bae0bf cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) /home/oscar/compiler/llvm-project/clang/tools/driver/cc1_main.cpp:250:0
#35 0x0000556af7ba3613 ExecuteCC1Tool(llvm::ArrayRef<char const*>,
llvm::StringRef) /home/oscar/compiler/llvm-
project/clang/tools/driver/driver.cpp:309:0
#36 0x0000556af7ba3d09 main /home/oscar/compiler/llvm-
project/clang/tools/driver/driver.cpp:382:0
#37 0x00007f9b3f4c0b97 __libc_start_main (/lib/x86_64-linux-
gnu/libc.so.6+0x21b97)
#38 0x0000556af7ba1dea _start (/usr/local/bin/clang-9+0x2b39dea)
clang-9: error: unable to execute command: Aborted (core dumped)
clang-9: 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
722b61892454b3217d73ec486e52156c5a92b5b3)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-9: 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-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-9: note: diagnostic msg: /tmp/34913-718d74.cpp
clang-9: note: diagnostic msg: /tmp/34913-718d74.sh
clang-9: note: diagnostic msg:

********************
Quuxplusone commented 4 years ago

Yep, seems to reproduce for me at 714075f9c1ac50cde20e21e559f0e29fdc848bf1