[llvm-bugs] [Bug 31947] New: Invalid cast to CXXRecordDecl in Sema::BuildPossibleImplicitMemberExpr

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Feb 13 07:14:26 PST 2017


http://bugs.llvm.org/show_bug.cgi?id=31947

            Bug ID: 31947
           Summary: Invalid cast to CXXRecordDecl in
                    Sema::BuildPossibleImplicitMemberExpr
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: llvm at meinersbur.de
                CC: llvm-bugs at lists.llvm.org

Created attachment 17973
  --> http://bugs.llvm.org/attachment.cgi?id=17973&action=edit
Testcase

The command 

$ clang durbin-aac882.c

crashes with

clang-5.0: /root/src/llvm/include/llvm/Support/Casting.h:236: typename
llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X =
clang::CXXRecordDecl; Y = clang::DeclContext; typename llvm::cast_retty<X,
Y*>::ret_type = clang::CXXRecordDecl*]: Assertion `isa<X>(Val) && "cast<Ty>()
argument of incompatible type!"' failed.
#0 0x00000000016bd69a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/root/build/llvm/release/bin/clang-5.0+0x16bd69a)
#1 0x00000000016bb33e llvm::sys::RunSignalHandlers()
(/root/build/llvm/release/bin/clang-5.0+0x16bb33e)
#2 0x00000000016bb4b2 SignalHandler(int)
(/root/build/llvm/release/bin/clang-5.0+0x16bb4b2)
#3 0x00007f876bff1390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#4 0x00007f876ad25428 gsignal
/build/glibc-t3gR2i/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
#5 0x00007f876ad2702a abort /build/glibc-t3gR2i/glibc-2.23/stdlib/abort.c:91:0
#6 0x00007f876ad1dbd7 __assert_fail_base
/build/glibc-t3gR2i/glibc-2.23/assert/assert.c:92:0
#7 0x00007f876ad1dc82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#8 0x00000000027ec78d
clang::Sema::BuildPossibleImplicitMemberExpr(clang::CXXScopeSpec const&,
clang::SourceLocation, clang::LookupResult&, clang::TemplateArgumentListInfo
const*, clang::Scope const*) (/root/build/llvm/release/bin/clang-5.0+0x27ec78d)
#9 0x0000000002764c48 clang::Sema::ActOnIdExpression(clang::Scope*,
clang::CXXScopeSpec&, clang::SourceLocation, clang::UnqualifiedId&, bool, bool,
std::unique_ptr<clang::CorrectionCandidateCallback,
std::default_delete<clang::CorrectionCandidateCallback> >, bool, clang::Token*)
(/root/build/llvm/release/bin/clang-5.0+0x2764c48)
#10 0x00000000023dca41 clang::Parser::ParseCastExpression(bool, bool, bool&,
clang::Parser::TypeCastState)
(/root/build/llvm/release/bin/clang-5.0+0x23dca41)
#11 0x00000000023dea0d clang::Parser::ParseCastExpression(bool, bool,
clang::Parser::TypeCastState)
(/root/build/llvm/release/bin/clang-5.0+0x23dea0d)
#12 0x00000000023deaa9
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState)
(/root/build/llvm/release/bin/clang-5.0+0x23deaa9)
#13 0x00000000023bd19f
clang::Parser::ParseBracketDeclarator(clang::Declarator&)
(/root/build/llvm/release/bin/clang-5.0+0x23bd19f)
#14 0x00000000023bd61b
clang::Parser::ParseMisplacedBracketDeclarator(clang::Declarator&)
(/root/build/llvm/release/bin/clang-5.0+0x23bd61b)
#15 0x00000000023c5ba7 clang::Parser::ParseDirectDeclarator(clang::Declarator&)
(/root/build/llvm/release/bin/clang-5.0+0x23c5ba7)
#16 0x00000000023bc8e4
clang::Parser::ParseDeclaratorInternal(clang::Declarator&, void
(clang::Parser::*)(clang::Declarator&))
(/root/build/llvm/release/bin/clang-5.0+0x23bc8e4)
#17 0x00000000023bcdc2 clang::Parser::ParseDeclarator(clang::Declarator&)
(/root/build/llvm/release/bin/clang-5.0+0x23bcdc2)
#18 0x00000000023c0962
clang::Parser::ParseStructDeclaration(clang::ParsingDeclSpec&,
llvm::function_ref<void (clang::ParsingFieldDeclarator&)>)
(/root/build/llvm/release/bin/clang-5.0+0x23c0962)
#19 0x00000000023c11f5
clang::Parser::ParseStructUnionBody(clang::SourceLocation, unsigned int,
clang::Decl*) (/root/build/llvm/release/bin/clang-5.0+0x23c11f5)
#20 0x00000000023d7d9d
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&)
(/root/build/llvm/release/bin/clang-5.0+0x23d7d9d)
#21 0x00000000023b7c68
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*)
(/root/build/llvm/release/bin/clang-5.0+0x23b7c68)
#22 0x000000000239d006
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/root/build/llvm/release/bin/clang-5.0+0x239d006)
#23 0x000000000239d7f1
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) [clone .part.160] [clone
.constprop.185] (/root/build/llvm/release/bin/clang-5.0+0x239d7f1)
#24 0x000000000239d84f
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
(/root/build/llvm/release/bin/clang-5.0+0x239d84f)
#25 0x000000000239f62f
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/root/build/llvm/release/bin/clang-5.0+0x239f62f)
#26 0x00000000023a3382
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/root/build/llvm/release/bin/clang-5.0+0x23a3382)
#27 0x00000000023a361c
clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/root/build/llvm/release/bin/clang-5.0+0x23a361c)
#28 0x000000000239881d clang::ParseAST(clang::Sema&, bool, bool)
(/root/build/llvm/release/bin/clang-5.0+0x239881d)
#29 0x0000000001f99d6a clang::CodeGenAction::ExecuteAction()
(/root/build/llvm/release/bin/clang-5.0+0x1f99d6a)
#30 0x0000000001bba266 clang::FrontendAction::Execute()
(/root/build/llvm/release/bin/clang-5.0+0x1bba266)
#31 0x0000000001b8cb76
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/root/build/llvm/release/bin/clang-5.0+0x1b8cb76)
#32 0x0000000001c41e3a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/root/build/llvm/release/bin/clang-5.0+0x1c41e3a)
#33 0x00000000009efd88 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/root/build/llvm/release/bin/clang-5.0+0x9efd88)
#34 0x00000000009a03dc main (/root/build/llvm/release/bin/clang-5.0+0x9a03dc)
#35 0x00007f876ad10830 __libc_start_main
/build/glibc-t3gR2i/glibc-2.23/csu/../csu/libc-start.c:325:0
#36 0x00000000009ec5d9 _start (/root/build/llvm/release/bin/clang-5.0+0x9ec5d9)

The file durbin-aac882.c (reduced using afl-tmin) is attached. clang trunk
r294933.

-- 
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/20170213/750bdfb9/attachment.html>


More information about the llvm-bugs mailing list