https://bugs.llvm.org/show_bug.cgi?id=43179
Bug ID: 43179
Summary: Assertion failure in CastValueChecker: ArrayRef
indexed out of bounds
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Static Analyzer
Assignee: dcough...@apple.com
Reporter: dkszelet...@gmail.com
CC: dcough...@apple.com, llvm-bugs@lists.llvm.org
On monorepo commit 485760f4c069177db8bedae8ee91c53cb5ab2be6:
$ cat preproc.cpp
namespace llvm {
template <typename> void cast(...);
void a() { cast<int>(int()); }
} // namespace llvm
$ clang -cc1 -analyze -analyzer-checker=core,apiModeling preproc.cpp
clang: llvm-project/llvm/include/llvm/ADT/ArrayRef.h:240: const T
&llvm::ArrayRef<clang::ParmVarDecl *>::operator[](size_t) const [T =
clang::ParmVarDecl *]: Assertion `Index < Length && "Invalid index!"' failed.
Stack dump:
0. Program arguments: llvm-project/build/bin/clang -cc1 -analyze
-analyzer-checker=core,apiModeling preproc.cpp
1. <eof> parser at end of file
2. While analyzing stack:
#0 Calling llvm::a
3. preproc.cpp:3:12: Error evaluating statement
4. preproc.cpp:3:12: Error evaluating statement
#0 0x00007f6c741d76d9 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
llvm-project/llvm/lib/Support/Unix/Signals.inc:532:11
#1 0x00007f6c741d7889 PrintStackTraceSignalHandler(void*)
llvm-project/llvm/lib/Support/Unix/Signals.inc:593:1
#2 0x00007f6c741d6156 llvm::sys::RunSignalHandlers()
llvm-project/llvm/lib/Support/Signals.cpp:67:5
#3 0x00007f6c741d7feb SignalHandler(int)
llvm-project/llvm/lib/Support/Unix/Signals.inc:384:1
#4 0x00007f6c73453890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
#5 0x00007f6c70654e97 raise
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#6 0x00007f6c70656801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
#7 0x00007f6c7064639a __assert_fail_base
/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
#8 0x00007f6c70646412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
#9 0x00007f6c6809c4cb llvm::ArrayRef<clang::ParmVarDecl*>::operator[](unsigned
long) const llvm-project/llvm/include/llvm/ADT/ArrayRef.h:0:7
#10 0x00007f6c6809bf63 (anonymous
namespace)::CastValueChecker::evalCall(clang::ento::CallEvent const&,
clang::ento::CheckerContext&) const
llvm-project/clang/lib/StaticAnalyzer/Checkers/CastValueChecker.cpp:401:23
#11 0x00007f6c6809be70 bool clang::ento::eval::Call::_evalCall<(anonymous
namespace)::CastValueChecker>(void*, clang::ento::CallEvent const&,
clang::ento::CheckerContext&)
llvm-project/clang/include/clang/StaticAnalyzer/Core/Checker.h:479:5
#12 0x00007f6c67a2a522 clang::ento::CheckerFn<bool (clang::ento::CallEvent
const&, clang::ento::CheckerContext&)>::operator()(clang::ento::CallEvent
const&, clang::ento::CheckerContext&) const
llvm-project/clang/include/clang/StaticAnalyzer/Core/CheckerManager.h:69:5
#13 0x00007f6c67a26a2e
clang::ento::CheckerManager::runCheckersForEvalCall(clang::ento::ExplodedNodeSet&,
clang::ento::ExplodedNodeSet const&, clang::ento::CallEvent const&,
clang::ento::ExprEngine&)
llvm-project/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp:674:19
#14 0x00007f6c67ab29d6
clang::ento::ExprEngine::evalCall(clang::ento::ExplodedNodeSet&,
clang::ento::ExplodedNode*, clang::ento::CallEvent const&)
llvm-project/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp:591:19
#15 0x00007f6c67ab2899 clang::ento::ExprEngine::VisitCallExpr(clang::CallExpr
const*, clang::ento::ExplodedNode*, clang::ento::ExplodedNodeSet&)
llvm-project/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp:512:16
#16 0x00007f6c67a73a22 clang::ento::ExprEngine::Visit(clang::Stmt const*,
clang::ento::ExplodedNode*, clang::ento::ExplodedNodeSet&)
llvm-project/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp:1587:7
#17 0x00007f6c67a7057c clang::ento::ExprEngine::ProcessStmt(clang::Stmt const*,
clang::ento::ExplodedNode*)
llvm-project/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp:791:9
#18 0x00007f6c67a70269
clang::ento::ExprEngine::processCFGElement(clang::CFGElement,
clang::ento::ExplodedNode*, unsigned int, clang::ento::NodeBuilderContext*)
llvm-project/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp:637:7
#19 0x00007f6c67a4422a clang::ento::CoreEngine::HandlePostStmt(clang::CFGBlock
const*, unsigned int, clang::ento::ExplodedNode*)
llvm-project/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp:469:1
#20 0x00007f6c67a438ec
clang::ento::CoreEngine::dispatchWorkItem(clang::ento::ExplodedNode*,
clang::ProgramPoint, clang::ento::WorkListUnit const&)
llvm-project/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp:195:1
#21 0x00007f6c67a434a5
clang::ento::CoreEngine::ExecuteWorkList(clang::LocationContext const*,
unsigned int, llvm::IntrusiveRefCntPtr<clang::ento::ProgramState const>)
llvm-project/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp:129:3
#22 0x00007f6c68e45d04
clang::ento::ExprEngine::ExecuteWorkList(clang::LocationContext const*,
unsigned int)
llvm-project/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h:168:5
#23 0x00007f6c68df4b36 (anonymous
namespace)::AnalysisConsumer::RunPathSensitiveChecks(clang::Decl*,
clang::ento::ExprEngine::InliningModes, llvm::DenseSet<clang::Decl const*,
llvm::DenseMapInfo<clang::Decl const*> >*)
llvm-project/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:801:7
#24 0x00007f6c68df46c4 (anonymous
namespace)::AnalysisConsumer::HandleCode(clang::Decl*, unsigned int,
clang::ento::ExprEngine::InliningModes, llvm::DenseSet<clang::Decl const*,
llvm::DenseMapInfo<clang::Decl const*> >*)
llvm-project/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:775:15
#25 0x00007f6c68d92271 (anonymous
namespace)::AnalysisConsumer::HandleDeclsCallGraph(unsigned int)
llvm-project/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:560:31
#26 0x00007f6c68d90e42 (anonymous
namespace)::AnalysisConsumer::runAnalysisOnTranslationUnit(clang::ASTContext&)
llvm-project/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:0:5
#27 0x00007f6c68d90102 (anonymous
namespace)::AnalysisConsumer::HandleTranslationUnit(clang::ASTContext&)
llvm-project/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:0:5
#28 0x00007f6c6b4c854c clang::ParseAST(clang::Sema&, bool, bool)
llvm-project/clang/lib/Parse/ParseAST.cpp:178:12
#29 0x00007f6c71d42f72 clang::ASTFrontendAction::ExecuteAction()
llvm-project/clang/lib/Frontend/FrontendAction.cpp:1044:1
#30 0x00007f6c71d42921 clang::FrontendAction::Execute()
llvm-project/clang/lib/Frontend/FrontendAction.cpp:939:7
#31 0x00007f6c71cbdb3a
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
llvm-project/clang/lib/Frontend/CompilerInstance.cpp:957:23
#32 0x00007f6c719065e2
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:289:8
#33 0x000000000024198e cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) llvm-project/clang/tools/driver/cc1_main.cpp:250:13
#34 0x000000000023548f ExecuteCC1Tool(llvm::ArrayRef<char const*>,
llvm::StringRef) llvm-project/clang/tools/driver/driver.cpp:310:5
#35 0x0000000000234832 main llvm-project/clang/tools/driver/driver.cpp:383:5
#36 0x00007f6c70637b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#37 0x000000000023402a _start (llvm-project/build/bin/clang+0x23402a)
Aborted (core dumped)
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs