Skip to content

crash on missing typename on dependent name #17300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
llvmbot opened this issue Aug 17, 2013 · 5 comments
Open

crash on missing typename on dependent name #17300

llvmbot opened this issue Aug 17, 2013 · 5 comments
Labels
bugzilla Issues migrated from bugzilla c++ clang:frontend Language frontend issues, e.g. anything involving "Sema" confirmed Verified by a second party crash-on-valid

Comments

@llvmbot
Copy link
Member

llvmbot commented Aug 17, 2013

Bugzilla Link 16926
Version 3.3
OS Linux
Reporter LLVM Bugzilla Contributor
CC @DougGregor

Extended Description

the invalid code

template <typename T>
struct A{
 template <typename U>
 struct B{};
};

template <typename T>
struct A2{
 template <typename U>
 struct B2{
  typedef /*typename*/ A<T>::template B<U> foo;
  foo bar;
 };
};

int main(){
 A2<int>::B2<int> bang;
 return 0;
}

crashes on

clang version 3.3 (tags/RELEASE_33/rc3)
Target: x86_64-redhat-linux-gnu
Thread model: posix

instead of complaining about the missing typename. This happens at instantiation time, a A2<int>::B2<int>* bang=0;"works.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 9, 2021
@wheatman
Copy link
Contributor

reproduces on 3.3
seems to have been fixed by 5.0,0
https://godbolt.org/z/Y9fE8Mcx1

@EugeneZelenko EugeneZelenko added the clang Clang issues not falling into any other category label Jun 26, 2023
@Endilll Endilll added clang:frontend Language frontend issues, e.g. anything involving "Sema" and removed clang Clang issues not falling into any other category labels Jun 27, 2023
@llvmbot
Copy link
Member Author

llvmbot commented Jun 27, 2023

@llvm/issue-subscribers-clang-frontend

@Endilll
Copy link
Contributor

Endilll commented Jun 27, 2023

This is another bug about typename that resurfaced in Clang 16: https://godbolt.org/z/xPGE9EM6n

clang++: /root/build/tools/clang/include/clang/AST/TypeNodes.inc:71:
clang::TypeInfo clang::ASTContext::getTypeInfoImpl(const clang::Type*) const:
Assertion `!T->isDependentType() && "should not see dependent types here"' failed.

Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics <source>
1.	<source>:17:23: current parser token ';'
2.	<source>:16:11: parsing function body 'main'
3.	<source>:16:11: in compound statement ('{}')
 #0 0x000055857607593f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3c5293f)
 #1 0x00005585760736ac llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3c506ac)
 #2 0x0000558575fbdd98 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007f1e6f00b420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007f1e6ead800b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #5 0x00007f1e6eab7859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #6 0x00007f1e6eab7729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
 #7 0x00007f1e6eac8fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #8 0x000055857970db2d clang::ASTContext::getTypeInfoImpl(clang::Type const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x72eab2d)
 #9 0x00005585796fb0bf clang::ASTContext::getTypeInfo(clang::Type const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x72d80bf)
#10 0x000055857970cc3b clang::ASTContext::getTypeInfoImpl(clang::Type const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x72e9c3b)
#11 0x00005585796fb0bf clang::ASTContext::getTypeInfo(clang::Type const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x72d80bf)
#12 0x000055857970d06d clang::ASTContext::getTypeInfoImpl(clang::Type const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x72ea06d)
#13 0x00005585796fb0bf clang::ASTContext::getTypeInfo(clang::Type const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x72d80bf)
#14 0x000055857970cc3b clang::ASTContext::getTypeInfoImpl(clang::Type const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x72e9c3b)
#15 0x00005585796fb0bf clang::ASTContext::getTypeInfo(clang::Type const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x72d80bf)
#16 0x000055857970ddf3 clang::ASTContext::getTypeInfoInChars(clang::Type const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x72eadf3)
#17 0x000055857970df5b clang::ASTContext::getTypeInfoInChars(clang::QualType) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x72eaf5b)
#18 0x0000558579b69875 (anonymous namespace)::ItaniumRecordLayoutBuilder::LayoutField(clang::FieldDecl const*, bool) RecordLayoutBuilder.cpp:0:0
#19 0x0000558579b6b10f (anonymous namespace)::ItaniumRecordLayoutBuilder::LayoutFields(clang::RecordDecl const*) RecordLayoutBuilder.cpp:0:0
#20 0x0000558579b67f01 clang::ASTContext::getASTRecordLayout(clang::RecordDecl const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7744f01)
#21 0x000055857970d981 clang::ASTContext::getTypeInfoImpl(clang::Type const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x72ea981)
#22 0x00005585796fb0bf clang::ASTContext::getTypeInfo(clang::Type const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x72d80bf)
#23 0x000055857970cabb clang::ASTContext::getTypeAlignInChars(clang::QualType) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x72e9abb)
#24 0x00005585789cc690 clang::Sema::CheckArgAlignment(clang::SourceLocation, clang::NamedDecl*, llvm::StringRef, clang::QualType, clang::QualType) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x65a9690)
#25 0x00005585789f162c clang::Sema::CheckConstructorCall(clang::FunctionDecl*, clang::QualType, llvm::ArrayRef<clang::Expr const*>, clang::FunctionProtoType const*, clang::SourceLocation) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x65ce62c)
#26 0x0000558578bedd2c clang::Sema::CompleteConstructorCall(clang::CXXConstructorDecl*, clang::QualType, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, llvm::SmallVectorImpl<clang::Expr*>&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67cad2c)
#27 0x0000558578f4c9f5 PerformConstructorInitialization(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>, clang::InitializationSequence::Step const&, bool&, bool, bool, clang::SourceLocation, clang::SourceLocation) SemaInit.cpp:0:0
#28 0x0000558578f61618 clang::InitializationSequence::Perform(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>, clang::QualType*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6b3e618)
#29 0x0000558578b40d55 clang::Sema::ActOnUninitializedDecl(clang::Decl*) (.part.0) SemaDecl.cpp:0:0
#30 0x0000558578811674 clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x63ee674)
#31 0x000055857881ec68 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x63fbc68)
#32 0x0000558578826fd9 clang::Parser::ParseSimpleDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, bool, clang::Parser::ForRangeInit*, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6403fd9)
#33 0x0000558578827459 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6404459)
#34 0x00005585788c9ccd clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x64a6ccd)
#35 0x00005585788caa11 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x64a7a11)
#36 0x00005585788cba09 clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x64a8a09)
#37 0x00005585788cd3ba clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x64aa3ba)
#38 0x00005585787f82b1 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x63d52b1)
#39 0x000055857881f1c0 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x63fc1c0)
#40 0x00005585787ebb51 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x63c8b51)
#41 0x00005585787ec40f clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.0) Parser.cpp:0:0
#42 0x00005585787f2db1 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x63cfdb1)
#43 0x00005585787f3726 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x63d0726)
#44 0x00005585787e74ca clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x63c44ca)
#45 0x00005585772ebec8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4ec8ec8)
#46 0x0000558576b36799 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4713799)
#47 0x0000558576abc0e6 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x46990e6)
#48 0x0000558576c1aeb6 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x47f7eb6)
#49 0x000055857351902d cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x10f602d)
#50 0x0000558573514d2a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#51 0x000055857691c7ed void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#52 0x0000558575fbe2a0 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3b9b2a0)
#53 0x000055857691ce0f clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#54 0x00005585768e3f7c clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44c0f7c)
#55 0x00005585768e4a0d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44c1a0d)
#56 0x00005585768ecaed clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44c9aed)
#57 0x000055857351728a clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x10f428a)
#58 0x000055857341d5a5 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xffa5a5)
#59 0x00007f1e6eab9083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#60 0x000055857350fb0e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x10ecb0e)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134

@Endilll Endilll reopened this Jun 27, 2023
@Endilll Endilll added confirmed Verified by a second party crash-on-valid labels Jun 27, 2023
@Endilll
Copy link
Contributor

Endilll commented Jun 27, 2023

Probably related to #17283

@Endilll
Copy link
Contributor

Endilll commented Jun 27, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla c++ clang:frontend Language frontend issues, e.g. anything involving "Sema" confirmed Verified by a second party crash-on-valid
Projects
None yet
Development

No branches or pull requests

4 participants