[llvm-bugs] [Bug 52139] New: CheckAbstractClassUsage triggers 'Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.'

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 11 12:36:33 PDT 2021


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

            Bug ID: 52139
           Summary: CheckAbstractClassUsage triggers 'Assertion
                    `isa<X>(Val) && "cast<Ty>() argument of incompatible
                    type!"' failed.'
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: phosek at chromium.org
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

Created attachment 25350
  --> https://bugs.llvm.org/attachment.cgi?id=25350&action=edit
Clang crash reproducer

We started seeing an assertion failures on our builders recently.

```
clang++: /src/clang-llvm/llvm-project/llvm/include/llvm/Support/Casting.h:269:
typename cast_retty<X, Y *>::ret_type llvm::cast(Y *) [X =
clang::CXXMethodDecl, Y = clang::FunctionDecl]: Assertion `isa<X>(Val) &&
"cast<Ty>() argument of incompatible type!"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: ./bin/clang++ -cc1 -triple x86_64-unknown-fuchsia
-emit-obj -mrelax-all -massembler-fatal-warnings --mrelax-relocations
-disable-free -main-file-name null.cc -mrelocation-model pic -pic-level 2
-fhalf-no-semantic-interposition -mframe-pointer=all -fno-rounding-math
-mconstructor-aliases -funwind-tables=2 -target-cpu x86-64-v2 -mllvm
-x86-branches-within-32B-boundaries -debug-info-kind=constructor
-dwarf-version=5 -debugger-tuning=gdb -mllvm
-crash-diagnostics-dir=clang-crashreports -ffunction-sections -fdata-sections
-fcoverage-compilation-dir=. -sys-header-deps -D _ALL_SOURCE -D
_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D
_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1 -D ZX_ASSERT_LEVEL=2 -D
FIDL_TRACE_LEVEL=0 -O0 -Wall -Wextra -Wconversion -Wimplicit-fallthrough
-Wnewline-eof -Wwrite-strings -Wno-sign-conversion -Wno-unused-parameter
-Werror -Wno-error=deprecated-declarations -Wthread-safety -std=c++17
-fdeprecated-macro -fdebug-compilation-dir=. -ferror-limit 19 -fvisibility
hidden -fvisibility-inlines-hidden -fsanitize=safe-stack -stack-protector 2
-ftrivial-auto-var-init=pattern -fno-rtti -fgnuc-version=4.2.1
-fno-legacy-pass-manager -fcolor-diagnostics -debug-info-kind=constructor
-faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -x c++ null-be55c6.cpp
1.      ../../sdk/lib/fdio/internal.h:284:2: current parser token ';'
2.      ../../sdk/lib/fdio/internal.h:135:1: parsing struct/union/class body
'fdio'
 #0 0x000000000939158a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
/src/clang-llvm/llvm-project/llvm/lib/Support/Unix/Signals.inc:565:11
 #1 0x000000000939169b PrintStackTraceSignalHandler(void*)
/src/clang-llvm/llvm-project/llvm/lib/Support/Unix/Signals.inc:632:1
 #2 0x000000000938ff53 llvm::sys::RunSignalHandlers()
/src/clang-llvm/llvm-project/llvm/lib/Support/Signals.cpp:97:5
 #3 0x0000000009391cd5 SignalHandler(int)
/src/clang-llvm/llvm-project/llvm/lib/Support/Unix/Signals.inc:407:1
 #4 0x00007f4341caa140 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x14140)
 #5 0x00007f43419b7ce1 raise (/lib/x86_64-linux-gnu/libc.so.6+0x3bce1)
 #6 0x00007f43419a1537 abort (/lib/x86_64-linux-gnu/libc.so.6+0x25537)
 #7 0x00007f43419a140f (/lib/x86_64-linux-gnu/libc.so.6+0x2540f)
 #8 0x00007f43419b0662 (/lib/x86_64-linux-gnu/libc.so.6+0x34662)
 #9 0x00000000097f4c28 llvm::cast_retty<clang::CXXMethodDecl,
clang::FunctionDecl*>::ret_type llvm::cast<clang::CXXMethodDecl,
clang::FunctionDecl>(clang::FunctionDecl*)
/src/clang-llvm/llvm-project/llvm/include/llvm/Support/Casting.h:270:10
#10 0x000000000d2d58bc CheckAbstractClassUsage((anonymous
namespace)::AbstractUsageInfo&, clang::CXXRecordDecl*)
/src/clang-llvm/llvm-project/clang/lib/Sema/SemaDeclCXX.cpp:5931:37
#11 0x000000000d2d47fa clang::Sema::CheckCompletedCXXClass(clang::Scope*,
clang::CXXRecordDecl*)
/src/clang-llvm/llvm-project/clang/lib/Sema/SemaDeclCXX.cpp:6682:8
#12 0x000000000d2de4ce
clang::Sema::ActOnFinishCXXMemberSpecification(clang::Scope*,
clang::SourceLocation, clang::Decl*, clang::SourceLocation,
clang::SourceLocation, clang::ParsedAttributesView const&)
/src/clang-llvm/llvm-project/clang/lib/Sema/SemaDeclCXX.cpp:9993:1
#13 0x000000000cc94ee4
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
clang::SourceLocation, clang::ParsedAttributesWithRange&, unsigned int,
clang::Decl*)
/src/clang-llvm/llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:3537:7
#14 0x000000000cc9321d
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::ParsedAttributesWithRange&)
/src/clang-llvm/llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:2034:7
#15 0x000000000ccbbc55
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*)
/src/clang-llvm/llvm-project/clang/lib/Parse/ParseDecl.cpp:4037:12
#16 0x000000000cc0f46a
clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
/src/clang-llvm/llvm-project/clang/lib/Parse/Parser.cpp:1051:7
#17 0x000000000cc0f070
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
/src/clang-llvm/llvm-project/clang/lib/Parse/Parser.cpp:1154:12
#18 0x000000000cc0e96f
clang::Parser::ParseExternalDeclaration(clang::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
/src/clang-llvm/llvm-project/clang/lib/Parse/Parser.cpp:976:12
#19 0x000000000cc0ccfb
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
/src/clang-llvm/llvm-project/clang/lib/Parse/Parser.cpp:720:12
#20 0x000000000cc07f14 clang::ParseAST(clang::Sema&, bool, bool)
/src/clang-llvm/llvm-project/clang/lib/Parse/ParseAST.cpp:158:16
#21 0x000000000a373eac clang::ASTFrontendAction::ExecuteAction()
/src/clang-llvm/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1065:1
#22 0x000000000a53c422 clang::CodeGenAction::ExecuteAction()
/src/clang-llvm/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:1099:5
#23 0x000000000a3738dc clang::FrontendAction::Execute()
/src/clang-llvm/llvm-project/clang/lib/Frontend/FrontendAction.cpp:960:7
#24 0x000000000a2b1cd1
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/src/clang-llvm/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:975:23
#25 0x000000000a52b037
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/src/clang-llvm/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:261:8
#26 0x0000000005d0f4f4 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) /src/clang-llvm/llvm-project/clang/tools/driver/cc1_main.cpp:246:13
#27 0x0000000005d0200b ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
/src/clang-llvm/llvm-project/clang/tools/driver/driver.cpp:317:5
#28 0x0000000005d010d5 main
/src/clang-llvm/llvm-project/clang/tools/driver/driver.cpp:388:5
#29 0x00007f43419a2d0a __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x26d0a)
#30 0x0000000005d0091a _start (./bin/clang+++0x5d0091a)
```

-- 
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/20211011/9d398fef/attachment.html>


More information about the llvm-bugs mailing list