Issue |
149280
|
Summary |
[clang] Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"` failed
|
Labels |
clang:frontend,
crash,
generated by fuzzer
|
Assignees |
|
Reporter |
Rush10233
|
Goes back to clang-6: https://godbolt.org/z/ss7hKK4YK
Generated by fuzzer that randomly adds `consteval` specifier to functions.
Simplified Test:
```c++
template<typename T>
consteval int foo(int i) {
T instance;
return i;
}
using func_type = int(int);
func_type* p = __builtin_addressof(foo);
```
Stack Dump:
```
clang++: /root/llvm-project/llvm/include/llvm/Support/Casting.h:578: decltype(auto) llvm::cast(From*) [with To = clang::OverloadExpr; From = clang::Expr]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
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 -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics <source>
1. <source>:8:40: current parser token ';'
#0 0x0000000003fbcfa8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3fbcfa8)
#1 0x0000000003fba3d4 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3fba3d4)
#2 0x0000000003efeba8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x0000799cd8242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x0000799cd82969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x0000799cd8242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x0000799cd82287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x0000799cd822871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x0000799cd8239e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x000000000688cd17 clang::OverloadExpr::find(clang::Expr*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x688cd17)
#10 0x0000000006f2856f clang::Sema::ResolveAddressOfOverloadedFunction(clang::Expr*, clang::QualType, bool, clang::DeclAccessPair&, bool*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6f2856f)
#11 0x0000000006f2c1ea IsStandardConversion(clang::Sema&, clang::Expr*, clang::QualType, bool, clang::StandardConversionSequence&, bool, bool) SemaOverload.cpp:0:0
#12 0x0000000006f2d5ad TryImplicitConversion(clang::Sema&, clang::Expr*, clang::QualType, bool, clang::Sema::AllowedExplicit, bool, bool, bool, bool) SemaOverload.cpp:0:0
#13 0x0000000006f3d952 clang::Sema::TryImplicitConversion(clang::Expr*, clang::QualType, bool, clang::Sema::AllowedExplicit, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6f3d952)
#14 0x0000000006cf870f clang::InitializationSequence::InitializeFrom(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6cf870f)
#15 0x0000000006a36371 clang::Sema::AddInitializerToDecl(clang::Decl*, clang::Expr*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6a36371)
#16 0x000000000669c27a clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x669c27a)
#17 0x00000000066aaad9 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66aaad9)
#18 0x000000000666851e clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x666851e)
#19 0x0000000006668cb9 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6668cb9)
#20 0x000000000667094a clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x667094a)
#21 0x00000000066718e5 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66718e5)
#22 0x00000000066636ba clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66636ba)
#23 0x000000000496e308 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x496e308)
#24 0x0000000004c61c75 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4c61c75)
#25 0x0000000004bde97e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4bde97e)
#26 0x0000000004d55741 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4d55741)
#27 0x0000000000d9e07f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xd9e07f)
#28 0x0000000000d94c5a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#29 0x00000000049d59c9 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
#30 0x0000000003eff044 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3eff044)
#31 0x00000000049d5fdf 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
#32 0x0000000004997eed clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4997eed)
#33 0x0000000004998f7e 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+++0x4998f7e)
#34 0x00000000049a1bc5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x49a1bc5)
#35 0x0000000000d9a52f clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xd9a52f)
#36 0x0000000000c4ea64 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc4ea64)
#37 0x0000799cd8229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#38 0x0000799cd8229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#39 0x0000000000d94705 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xd94705)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs