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

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 31 10:52:14 PST 2020


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

            Bug ID: 44737
           Summary: Assertion `isa<X>(Val) && "cast<Ty>() argument o f
                    incompatible type!"' failed.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: changochen1 at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

POC:
---
# 1 "<built-in>"
# 1 "test1.c"
struct {
  struct {
    int a
  } char : a
---

Run script:
---
# Crash reproducer for clang version 11.0.0
(https://github.com/llvm/llvm-project.git
56b7f595d2b402ff177ca42214325c8fdea10fb0)
# Driver args: "-x" "c" "test1.c" "-o" "test"
# Original command:  "/home/rxz226/llvm-project/bld_instru/bin/clang-11" "-cc1"
"-triple" "x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free"
"-main-file-name" "test1.c" "-mrelocation-model" "static" "-mthread-model"
"posix" "-mframe-pointer=all" "-fmath-errno" "-fno-rounding-math"
"-masm-verbose" "-mconstructor-aliases" "-munwind-tables" "-target-cpu"
"x86-64" "-dwarf-column-info" "-fno-split-dwarf-inlining"
"-debugger-tuning=gdb" "-resource-dir"
"/home/rxz226/llvm-project/bld_instru/lib/clang/11.0.0" "-internal-isystem"
"/usr/local/include" "-internal-isystem"
"/home/rxz226/llvm-project/bld_instru/lib/clang/11.0.0/include"
"-internal-externc-isystem" "/usr/include/x86_64-linux-gnu"
"-internal-externc-isystem" "/include" "-internal-externc-isystem"
"/usr/include" "-fdebug-compilation-dir" "/home/rxz226/fuzz_clang1/hangs/test"
"-ferror-limit" "19" "-fmessage-length" "0" "-fgnuc-version=4.2.1"
"-fobjc-runtime=gcc" "-fdiagnostics-show-option" "-fcolor-diagnostics"
"-faddrsig" "-o" "/tmp/test1-6a6833.o" "-x" "c" "test1.c"
 "/home/rxz226/llvm-project/bld_instru/bin/clang-11" "-cc1" "-triple"
"x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free"
"-main-file-name" "test1.c" "-mrelocation-model" "static" "-mthread-model"
"posix" "-mframe-pointer=all" "-fmath-errno" "-fno-rounding-math"
"-masm-verbose" "-mconstructor-aliases" "-munwind-tables" "-target-cpu"
"x86-64" "-dwarf-column-info" "-fno-split-dwarf-inlining"
"-debugger-tuning=gdb" "-ferror-limit" "19" "-fmessage-length" "0"
"-fgnuc-version=4.2.1" "-fobjc-runtime=gcc" "-fdiagnostics-show-option"
"-fcolor-diagnostics" "-faddrsig" "-x" "c" "test1-88dd93.c"
---


Stack dump:
---
 #0 0x000000000681faf6 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/rxz226/llvm-project/llvm/lib/Support/Unix/Signals.inc:560:7
 #1 0x000000000681ac5e llvm::sys::RunSignalHandlers()
/home/rxz226/llvm-project/llvm/lib/Support/Signals.cpp:69:18
 #2 0x000000000681dd30 llvm::sys::CleanupOnSignal(unsigned long)
/home/rxz226/llvm-project/llvm/lib/Support/Unix/Signals.inc:361:3
 #3 0x000000000662a5aa (anonymous
namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long)
/home/rxz226/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:80:5
 #4 0x000000000662a9e6
/home/rxz226/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:361:51
 #5 0x00007f949c8e3390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
 #6 0x00007f949b44d428 raise
/build/glibc-LK5gWL/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
 #7 0x00007f949b44f02a abort /build/glibc-LK5gWL/glibc-2.23/stdlib/abort.c:91:0
 #8 0x00007f949b445bd7 __assert_fail_base
/build/glibc-LK5gWL/glibc-2.23/assert/assert.c:92:0
 #9 0x00007f949b445c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#10 0x000000000ca9bc25 ClassifyImplicitMemberAccess(clang::Sema&,
clang::LookupResult const&)
/home/rxz226/llvm-project/llvm/include/llvm/Support/Casting.h:0:3
#11 0x000000000ca9bc25
clang::Sema::BuildPossibleImplicitMemberExpr(clang::CXXScopeSpec const&,
clang::SourceLocation, clang::LookupResult&, clang::TemplateArgumentListInfo
const*, clang::Scope const*) /home/rxz226/llvm-project$
clang/lib/Sema/SemaExprMember.cpp:240:0
#12 0x000000000c66fdc4 clang::Sema::ActOnIdExpression(clang::Scope*,
clang::CXXScopeSpec&, clang::SourceLocation, clang::UnqualifiedId&, bool, bool,
clang::CorrectionCandidateCallback*, bool, clang::Token*) /home/rxz226/llvm-pr$
ject/clang/lib/Sema/SemaExpr.cpp:2502:14
#13 0x000000000bca1b64
clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&,
clang::Parser::TypeCastState, bool, bool*)
/home/rxz226/llvm-project/clang/lib/Parse/ParseExpr.cpp:1220:19
#14 0x000000000bc91a90
clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool,
clang::Parser::TypeCastState, bool, bool*)
/home/rxz226/llvm-project/clang/lib/Parse/ParseExpr.cpp:663:20
#15 0x000000000bc96cab
clang::Parser::ParseConstantExpressionInExprEvalContext(clang::Parser::TypeCastState)
/home/rxz226/llvm-project/clang/lib/Parse/ParseExpr.cpp:207:18
#16 0x000000000bc96deb
clang::EnterExpressionEvaluationContext::~EnterExpressionEvaluationContext()
/home/rxz226/llvm-project/clang/include/clang/Sema/Sema.h:0:0
#17 0x000000000bc96deb
clang::Parser::ParseConstantExpression(clang::Parser::TypeCastState)
/home/rxz226/llvm-project/clang/lib/Parse/ParseExpr.cpp:219:0
#18 0x000000000bc20c64 clang::ActionResult<clang::Expr*, true>::isInvalid()
const /home/rxz226/llvm-project/clang/include/clang/Sema/Ownership.h:0:0
#19 0x000000000bc20c64
clang::Parser::ParseStructDeclaration(clang::ParsingDeclSpec&,
llvm::function_ref<void (clang::ParsingFieldDeclarator&)>)
/home/rxz226/llvm-project/clang/lib/Parse/ParseDecl.cpp:4178:0
#20 0x000000000bc2216f clang::ParsingDeclSpec::~ParsingDeclSpec()
/home/rxz226/llvm-project/clang/include/clang/Parse/RAIIObjectsForParser.h:0:0
#21 0x000000000bc2216f
clang::Parser::ParseStructUnionBody(clang::SourceLocation,
clang::TypeSpecifierType, clang::Decl*)
/home/rxz226/llvm-project/clang/lib/Parse/ParseDecl.cpp:4282:0
#22 0x000000000bc60e0d
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, cl
ang::Parser::ParsedAttributesWithRange&)
/home/rxz226/llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:1966:20
#23 0x000000000bc04059 clang::ParsedAttributesView::empty() const
/home/rxz226/llvm-project/clang/include/clang/Sema/ParsedAttr.h:0:0
#24 0x000000000bc04059
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) /home/rxz22
6/llvm-project/clang/lib/Parse/ParseDecl.cpp:3939:0
#25 0x000000000bbbdbcf
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
/home/rxz226/llvm-project/clang/lib/Parse/Parser.cpp:1020:10
#26 0x000000000bbbcfe9
clang::Parser::ObjCDeclContextSwitch::~ObjCDeclContextSwitch()
/home/rxz226/llvm-project/clang/include/clang/Parse/Parser.h:0:0
...
---

-- 
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/20200131/a4d6e0d9/attachment.html>


More information about the llvm-bugs mailing list