[llvm-bugs] [Bug 44926] New: Assertion `isa<T>(CanonicalType)' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Feb 15 11:22:06 PST 2020


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

            Bug ID: 44926
           Summary: Assertion `isa<T>(CanonicalType)' failed.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: changochen1 at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

POC:
---
int main ( ) {
        void * p ;
        if ( p -> memcmp < 1 ) return 1 ;
        return 0 ;
}
---

Run script:
---
# Crash reproducer for clang version 11.0.0
(https://github.com/llvm/llvm-project.git
56b7f595d2b402ff177ca42214325c8fdea10fb0)
# Driver args: "--driver-mode=g++" "-x" "c++" "-o" "tm" "./test1.c"
# Original command:  "/data/rxz226/llvm-project/bld/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"
"/data/rxz226/llvm-project/bld/lib/clang/11.0.0" "-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/x86_64-linux-gnu/c++/7.4.0"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/x86_64-linux-gnu/c++/7.4.0"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/backward"
"-internal-isystem" "/usr/local/include" "-internal-isystem"
"/data/rxz226/llvm-project/bld/lib/clang/11.0.0/include"
"-internal-externc-isystem" "/usr/include/x86_64-linux-gnu"
"-internal-externc-isystem" "/include" "-internal-externc-isystem"
"/usr/include" "-fdeprecated-macro" "-fdebug-compilation-dir"
"/home/rxz226/c_reduce" "-ferror-limit" "19" "-fmessage-length" "0"
"-fgnuc-version=4.2.1" "-fobjc-runtime=gcc" "-fcxx-exceptions" "-fexceptions"
"-fdiagnostics-show-option" "-fcolor-diagnostics" "-faddrsig" "-o"
"/tmp/test1-ca737a.o" "-x" "c++" "./test1.c"
 "/data/rxz226/llvm-project/bld/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" "-fdeprecated-macro" "-ferror-limit" "19"
"-fmessage-length" "0" "-fgnuc-version=4.2.1" "-fobjc-runtime=gcc"
"-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option"
"-fcolor-diagnostics" "-faddrsig" "-x" "c++" "test1-0fb747.cpp"
---


Stack dump:
---
clang++: /home/rxz226/llvm-project/clang/include/clang/AST/Type.h:7072: const
T* clang::Type::castAs() const [with T = clang::TagType]: Assertion
`isa<T>(CanonicalType)' failed.                                         
[100/203]
Stack dump:
0.      Program arguments: /home/rxz226/llvm-project/bld/bin/clang++ -x c++ -o
tm ./test1.c
1.      ./test1.c:3:12: current parser token 'memcmp'
2.      ./test1.c:1:14: parsing function body 'main'
3.      ./test1.c:1:14: in compound statement ('{}')
 #0 0x000000000511679b llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/rxz226/llvm-project/llvm/lib/Support/Unix/Signals.inc:564:0
 #1 0x000000000511682e PrintStackTraceSignalHandler(void*)
/home/rxz226/llvm-project/llvm/lib/Support/Unix/Signals.inc:625:0
 #2 0x00000000051145b6 llvm::sys::RunSignalHandlers()
/home/rxz226/llvm-project/llvm/lib/Support/Signals.cpp:68:0
 #3 0x0000000005115fd7 llvm::sys::CleanupOnSignal(unsigned long)
/home/rxz226/llvm-project/llvm/lib/Support/Unix/Signals.inc:361:0
 #4 0x000000000501be1f (anonymous
namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long)
/home/rxz226/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:80:0
 #5 0x000000000501c2fe CrashRecoverySignalHandler(int)
/home/rxz226/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:362:0
 #6 0x00007f2124a39390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
 #7 0x00007f2123748428 raise
/build/glibc-LK5gWL/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
 #8 0x00007f212374a02a abort /build/glibc-LK5gWL/glibc-2.23/stdlib/abort.c:91:0
 #9 0x00007f2123740bd7 __assert_fail_base
/build/glibc-LK5gWL/glibc-2.23/assert/assert.c:92:0
#10 0x00007f2123740c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#11 0x0000000008403be2 clang::TagType const*
clang::Type::castAs<clang::TagType>() const
/home/rxz226/llvm-project/clang/include/clang/AST/Type.h:7073:0
#12 0x00000000082fefd6 clang::Sema::LookupTemplateName(clang::LookupResult&,
clang::Scope*, clang::CXXScopeSpec&, clang::QualType, bool, bool&,
clang::SourceLocation, clang::Sema::AssumedTemplateKind*)
/home/rxz226/llvm-project$
clang/lib/Sema/SemaTemplate.cpp:348:0
#13 0x00000000082fe3fa clang::Sema::isTemplateName(clang::Scope*,
clang::CXXScopeSpec&, bool, clang::UnqualifiedId const&,
clang::OpaquePtr<clang::QualType>, bool,
clang::OpaquePtr<clang::TemplateName>&, bool&) /home/rxz226/llv$
-project/clang/lib/Sema/SemaTemplate.cpp:163:0
#14 0x0000000007a71f0f
clang::Parser::ParseOptionalCXXScopeSpecifier(clang::CXXScopeSpec&,
clang::OpaquePtr<clang::QualType>, bool, bool*, bool, clang::IdentifierInfo**,
bool, bool) /home/rxz226/llvm-project/clang/lib/Parse/Par$
eExprCXX.cpp:489:0
#15 0x0000000007a66802
clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*,
true>) /home/rxz226/llvm-project/clang/lib/Parse/ParseExpr.cpp:1988:0
#16 0x0000000007a64fe7
clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&,
clang::Parser::TypeCastState, bool, bool*)
/home/rxz226/llvm-project/clang/lib/Parse/ParseExpr.cpp:1706:0
#17 0x0000000007a60d00
clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool,
clang::Parser::TypeCastState, bool, bool*)
/home/rxz226/llvm-project/clang/lib/Parse/ParseExpr.cpp:668:0
#18 0x0000000007a5e893
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState)
/home/rxz226/llvm-project/clang/lib/Parse/ParseExpr.cpp:175:0
#19 0x0000000007a5e5eb
clang::Parser::ParseExpression(clang::Parser::TypeCastState)
/home/rxz226/llvm-project/clang/lib/Parse/ParseExpr.cpp:124:0
#20 0x0000000007a77cb7
clang::Parser::ParseCXXCondition(clang::ActionResult<clang::Stmt*, true>*,
clang::SourceLocation, clang::Sema::ConditionKind,
clang::Parser::ForRangeInfo*) /home/rxz226/llvm-project/clang/lib/Parse/ParseEx
prCXX.cpp:1992:0
#21 0x0000000007acf23b
clang::Parser::ParseParenExprOrCondition(clang::ActionResult<clang::Stmt*,
true>*, clang::Sema::ConditionResult&, clang::SourceLocation,
clang::Sema::ConditionKind) /home/rxz226/llvm-project/clang/lib/Pars
e/ParseStmt.cpp:1157:0
#22 0x0000000007acfd68 clang::Parser::ParseIfStatement(clang::SourceLocation*)
/home/rxz226/llvm-project/clang/lib/Parse/ParseStmt.cpp:1332:0
#23 0x0000000007acbdaf
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&) /home/r
xz226/llvm-project/clang/lib/Parse/ParseStmt.cpp:255:0
#24 0x0000000007acb467
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*)
/home/rxz226/llvm-project/clang/lib/Parse/ParseStmt.cpp:107:0
#25 0x0000000007acedbc clang::Parser::ParseCompoundStatementBody(bool)
/home/rxz226/llvm-project/clang/lib/Parse/ParseStmt.cpp:1079:0
#26 0x0000000007ad33a5 clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&)
/home/rxz226/llvm-project/clang/lib/Parse/ParseStmt.cpp:2204:0
#27 0x0000000007a007cc
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
/home/rxz226/llvm-project/clang/lib/Parse/Parser.cpp:1349:0
...q
---

-- 
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/20200215/d8d6d398/attachment.html>


More information about the llvm-bugs mailing list