[llvm-bugs] [Bug 44742] New: Assertion `getType(Base)->isPoin terType() || getType(Base)->isArrayType()' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 31 11:57:02 PST 2020


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

            Bug ID: 44742
           Summary: Assertion `getType(Base)->isPoin terType() ||
                    getType(Base)->isArrayType()' failed.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          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"
a[ ;
a[];
b = a
---

Run script:
---
# Crash reproducer for clang version 11.0.0
(https://github.com/llvm/llvm-project.git
56b7f595d2b402ff177ca42214325c8fdea10fb0)
# Driver args: "-x" "c" "-o" "test" "test1.c"
# 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_clang3/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-636b7b.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-8f3c4a.c"
---

Stack dump:
---
clang: /home/rxz226/llvm-project/clang/lib/AST/ExprConstant.cpp:1581: void
(anonymous namespace)::LValue::addUnsizedArray((anonymous namespace)::EvalInfo
&, const clang::Expr *, clang::QualType): Assertion `getType(Base)->isPoin
terType() || getType(Base)->isArrayType()' failed.
Stack dump:
0.      Program arguments: /home/rxz226/llvm-project/bld_instru/bin/clang -x c
-o test test1.c
1.      <eof> parser at end of file
 #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 0x00007f89d31f0390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
 #6 0x00007f89d1d5a428 raise
/build/glibc-LK5gWL/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
 #7 0x00007f89d1d5c02a abort /build/glibc-LK5gWL/glibc-2.23/stdlib/abort.c:91:0
 #8 0x00007f89d1d52bd7 __assert_fail_base
/build/glibc-LK5gWL/glibc-2.23/assert/assert.c:92:0
 #9 0x00007f89d1d52c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#10 0x000000000e657182
/home/rxz226/llvm-project/clang/lib/AST/ExprConstant.cpp:1581:9
#11 0x000000000e65a619 (anonymous
namespace)::PointerExprEvaluator::VisitCastExpr(clang::CastExpr const*)
/home/rxz226/llvm-project/clang/lib/AST/ExprConstant.cpp:0:14
#12 0x000000000e595175 clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous
namespace)::PointerExprEvaluator, bool>::Visit(clang::Stmt const*)
/home/rxz226/llvm-project/bld_instru/tools/clang/include/clang/AST/StmtNodes.inc:0
:0
#13 0x000000000e5910cf EvaluatePointer(clang::Expr const*, (anonymous
namespace)::LValue&, (anonymous namespace)::EvalInfo&, bool)
/home/rxz226/llvm-project/clang/lib/AST/ExprConstant.cpp:7968:3
#14 0x000000000e648ccf (anonymous
namespace)::IntExprEvaluator::VisitCastExpr(clang::CastExpr const*)
/home/rxz226/llvm-project/clang/lib/AST/ExprConstant.cpp:12441:10
#15 0x000000000e5e54c0 clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous
namespace)::IntExprEvaluator, bool>::Visit(clang::Stmt const*)
/home/rxz226/llvm-project/bld_instru/tools/clang/include/clang/AST/StmtNodes.inc:0:0
#16 0x000000000e55077f Evaluate(clang::APValue&, (anonymous
namespace)::EvalInfo&, clang::Expr const*)
/home/rxz226/llvm-project/clang/lib/AST/ExprConstant.cpp:13547:9
#17 0x000000000e556887 EvaluateAsRValue((anonymous namespace)::EvalInfo&,
clang::Expr const*, clang::APValue&)
/home/rxz226/llvm-project/clang/lib/AST/ExprConstant.cpp:13655:10
#18 0x000000000e54acce EvaluateAsRValue(clang::Expr const*,
clang::Expr::EvalResult&, clang::ASTContext const&, (anonymous
namespace)::EvalInfo&)
/home/rxz226/llvm-project/clang/lib/AST/ExprConstant.cpp:13712:10
#19 0x000000000e54acce clang::Expr::EvaluateAsRValue(clang::Expr::EvalResult&,
clang::ASTContext const&, bool) const
/home/rxz226/llvm-project/clang/lib/AST/ExprConstant.cpp:13758:0
#20 0x000000000e555974 clang::Expr::isEvaluatable(clang::ASTContext const&,
clang::Expr::SideEffectsKind) const
/home/rxz226/llvm-project/clang/lib/AST/ExprConstant.cpp:13951:10
#21 0x000000000e522f4c clang::Expr::isConstantInitializer(clang::ASTContext&,
bool, clang::Expr const**) const
/home/rxz226/llvm-project/clang/lib/AST/Expr.cpp:3362:7
#22 0x000000000c16f183 clang::Sema::CheckForConstantInitializer(clang::Expr*,
clang::QualType) /home/rxz226/llvm-project/clang/lib/Sema/SemaDecl.cpp:10898:7
#23 0x000000000c17675e clang::Sema::AddInitializerToDecl(clang::Decl*,
clang::Expr*, bool) /home/rxz226/llvm-project/clang/lib/Sema/SemaDecl.cpp:0:7
#24 0x000000000bc15c12
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*)
/home/rxz226/llvm-project/clang/lib/Parse/ParseDecl.c
pp:0:17
#25 0x000000000bc10989 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
/home/rxz226/llvm-project/clang/lib/Parse/ParseDecl.cpp:2128:9
#26 0x000000000bbbe8b9
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
/home/rxz226/llvm-project/clang/lib/Parse/Parser.cpp:0:10
#27 0x000000000bbbcfe9
clang::Parser::ObjCDeclContextSwitch::~ObjCDeclContextSwitch()
/home/rxz226/llvm-project/clang/include/clang/Parse/Parser.h:0:0
#28 0x000000000bbbcfe9
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
/home/rxz226/llvm-project/clang/lib/Parse/Parser.cpp:1126:0
#29 0x000000000bbbae53
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
/home/rxz226/llvm-project/clang/lib/Parse/Parser.cpp:945:12
#30 0x000000000bbb658c
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
/home/rxz226/llvm-project/clang/lib/Parse/Parser.cpp:696:10
#31 0x000000000bbabb7b clang::ParseAST(clang::Sema&, bool, bool)
/home/rxz226/llvm-project/clang/lib/Parse/ParseAST.cpp:157:15
....
---

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


More information about the llvm-bugs mailing list