[PATCH] Loss of Sign Checker
Daniel Marjamäki
daniel.marjamaki at evidente.se
Tue Jun 23 06:25:12 PDT 2015
hmm.. I get stack dumps.
Please review the code around line 151 in LossOfSignChecker.cpp
To reproduce a dump on a linux box, you can use such commands:
$ wget ftp://ftp.sunet.se/pub/Linux/distributions/Debian/debian/pool/main/a/a52dec/a52dec_0.7.4.orig.tar.gz
$ tar xzvf a52dec_0.7.4.orig.tar.gz
$ cd a52dec-0.7.4
$ ./configure
$ ~/llvm/tools/clang/tools/scan-build/scan-build --use-analyzer=/home/$USER/llvm/build/Debug+Asserts/bin/clang -enable-checker alpha.core.LossOfSign make
Stack dump:
#0 0x46e3574 llvm::sys::PrintStackTrace(llvm::raw_ostream&) /home/danielm/llvm/lib/Support/Unix/Signals.inc:437:0
#1 0x46e3889 PrintStackTraceSignalHandler(void*) /home/danielm/llvm/lib/Support/Unix/Signals.inc:495:0
#2 0x46e238a SignalHandler(int) /home/danielm/llvm/lib/Support/Unix/Signals.inc:210:0
#3 0x2ab6b09cc340 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x16c8922 clang::Expr::getType() const /home/danielm/llvm/tools/clang/lib/Serialization/../../include/clang/AST/Expr.h:125:0
#5 0x2257417 (anonymous namespace)::LossOfSignChecker::checkASTDecl(clang::VarDecl const*, clang::ento::AnalysisManager&, clang::ento::BugReporter&) const /home/danielm/llvm/tools/clang/lib/StaticAnalyzer/Checkers/LossOfSignChecker.cpp:151:0
#6 0x2257a9a void clang::ento::check::ASTDecl<clang::VarDecl>::_checkDecl<(anonymous namespace)::LossOfSignChecker>(void*, clang::Decl const*, clang::ento::AnalysisManager&, clang::ento::BugReporter&) /home/danielm/llvm/tools/clang/lib/StaticAnalyzer/Checkers/../../../in
clude/clang/StaticAnalyzer/Core/Checker.h:34:0
#7 0x23b57d7 clang::ento::CheckerFn<void (clang::Decl const*, clang::ento::AnalysisManager&, clang::ento::BugReporter&)>::operator()(clang::Decl const*, clang::ento::AnalysisManager&, clang::ento::BugReporter&) const /home/danielm/llvm/tools/clang/lib/StaticAnalyzer/Core
/../../../include/clang/StaticAnalyzer/Core/CheckerManager.h:59:0
#8 0x23b1d84 clang::ento::CheckerManager::runCheckersOnASTDecl(clang::Decl const*, clang::ento::AnalysisManager&, clang::ento::BugReporter&) /home/danielm/llvm/tools/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp:76:0
#9 0x216369f (anonymous namespace)::AnalysisConsumer::VisitDecl(clang::Decl*) /home/danielm/llvm/tools/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:342:0
#10 0x2191929 clang::DataRecursiveASTVisitor<(anonymous namespace)::AnalysisConsumer>::WalkUpFromDecl(clang::Decl*) /home/danielm/llvm/tools/clang/lib/StaticAnalyzer/Frontend/../../../include/clang/AST/DataRecursiveASTVisitor.h:400:0
#11 0x219e05d clang::DataRecursiveASTVisitor<(anonymous namespace)::AnalysisConsumer>::WalkUpFromNamedDecl(clang::NamedDecl*) /home/danielm/llvm/build/tools/clang/lib/StaticAnalyzer/Frontend/../../../include/clang/AST/DeclNodes.inc:89:0
#12 0x21a0081 clang::DataRecursiveASTVisitor<(anonymous namespace)::AnalysisConsumer>::WalkUpFromValueDecl(clang::ValueDecl*) /home/danielm/llvm/build/tools/clang/lib/StaticAnalyzer/Frontend/../../../include/clang/AST/DeclNodes.inc:323:0
#13 0x219fe29 clang::DataRecursiveASTVisitor<(anonymous namespace)::AnalysisConsumer>::WalkUpFromDeclaratorDecl(clang::DeclaratorDecl*) /home/danielm/llvm/build/tools/clang/lib/StaticAnalyzer/Frontend/../../../include/clang/AST/DeclNodes.inc:327:0
#14 0x2185585 clang::DataRecursiveASTVisitor<(anonymous namespace)::AnalysisConsumer>::WalkUpFromVarDecl(clang::VarDecl*) /home/danielm/llvm/build/tools/clang/lib/StaticAnalyzer/Frontend/../../../include/clang/AST/DeclNodes.inc:397:0
#15 0x2171612 clang::DataRecursiveASTVisitor<(anonymous namespace)::AnalysisConsumer>::TraverseVarDecl(clang::VarDecl*) /home/danielm/llvm/tools/clang/lib/StaticAnalyzer/Frontend/../../../include/clang/AST/DataRecursiveASTVisitor.h:1787:0
#16 0x2167947 clang::DataRecursiveASTVisitor<(anonymous namespace)::AnalysisConsumer>::TraverseDecl(clang::Decl*) /home/danielm/llvm/build/tools/clang/lib/StaticAnalyzer/Frontend/../../../include/clang/AST/DeclNodes.inc:397:0
#17 0x2164065 (anonymous namespace)::AnalysisConsumer::HandleTranslationUnit(clang::ASTContext&) /home/danielm/llvm/tools/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:537:0
#18 0x19fa91c clang::ParseAST(clang::Sema&, bool, bool) /home/danielm/llvm/tools/clang/lib/Parse/ParseAST.cpp:153:0
#19 0x13e5ebe clang::ASTFrontendAction::ExecuteAction() /home/danielm/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:538:0
#20 0x13e597b clang::FrontendAction::Execute() /home/danielm/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:443:0
#21 0x13a763e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /home/danielm/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:819:0
#22 0x136733f clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/danielm/llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:222:0
#23 0x1351746 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /home/danielm/llvm/tools/clang/tools/driver/cc1_main.cpp:112:0
#24 0x1360de3 ExecuteCC1Tool(llvm::ArrayRef<char const*>, llvm::StringRef) /home/danielm/llvm/tools/clang/tools/driver/driver.cpp:358:0
#25 0x13613f5 main /home/danielm/llvm/tools/clang/tools/driver/driver.cpp:404:0
#26 0x2ab6b1848ec5 __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:321:0
#27 0x134fbe9 _start (/home/danielm/llvm/build/Debug+Asserts/bin-sign/clang+0x134fbe9)
Stack dump:
0. Program arguments: /home/danielm/llvm/build/Debug+Asserts/bin-sign/clang -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -main-file-name imdct.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-eagerly-assume -analyzer-checker=cor
e -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.in
secureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-output plist -w -mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version 2.24 -momit
-leaf-frame-pointer -dwarf-column-info -resource-dir /home/danielm/llvm/build/Debug+Asserts/bin-sign/../lib/clang/3.7.0 -D HAVE_CONFIG_H -I . -I . -I ../include -I ../include -I ../include -internal-isystem /usr/local/include -internal-isystem /home/danielm/llvm/build/De
bug+Asserts/bin-sign/../lib/clang/3.7.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -fdebug-compilation-dir /home/danielm/daca-clang-sign/a52dec-0.7.4/liba52 -ferror-limit 1
9 -fmessage-length 0 -mstackrealign -fobjc-runtime=gcc -fdiagnostics-show-option -vectorize-loops -vectorize-slp -analyzer-checker alpha.core.LossOfSign -analyzer-output=plist -o /home/danielm/daca-clang-signplist-output/2015-06-23-144232-17041-1/report-FjusPt.plist -x c imdct.c
http://reviews.llvm.org/D10634
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the cfe-commits
mailing list