[PATCH] [Clang Static Analyzer] Bug identification

Honggyu Kim hong.gyu.kim at lge.com
Wed Jun 10 08:03:47 PDT 2015


Hi Babati,

I have been thinking about the same issue recently in order to distinguish new warnings by making a diff view from two clang SA reports.
Thanks a lot for this work :)

I just applied your patch to test it, then executed and I successfully got bug_id in plist with the following simple example.

int main(void)
{

  int a;
  return a;

}

But I faced a bug when I run "clang --analyze main.c" with the following example.

int main()
{

  int a;
  return a;

}

The only difference is having void in parameter.
I have attached the backtrace log, so please have a look at it.

$ clang --analyze main.c
main.c:4:3: warning: Undefined or garbage value returned to caller

  return a;
  ^~~~~~~~

#0 0x478f70c llvm::sys::PrintStackTrace(llvm::raw_ostream&) /home/hong.gyu.kim/src/llvm/git/new/llvm/lib/Support/Unix/Signals.inc:437:0
#1 0x478fa21 PrintStackTraceSignalHandler(void*) /home/hong.gyu.kim/src/llvm/git/new/llvm/lib/Support/Unix/Signals.inc:495:0
#2 0x478e515 SignalHandler(int) /home/hong.gyu.kim/src/llvm/git/new/llvm/lib/Support/Unix/Signals.inc:210:0
#3 0x7fcc193fdcb0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0xfcb0)
#4 0x15eb4ae clang::FunctionProtoType::getRefQualifier() const /home/hong.gyu.kim/src/llvm/git/new/llvm/tools/clang/lib/Serialization/../../include/clang/AST/Type.h:3117:0
#5 0x24a8304 GetSignature(clang::FunctionDecl const*) /home/hong.gyu.kim/src/llvm/git/new/llvm/tools/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:357:0
#6 0x24a845d GetEnclosingDeclContextSignature(clang::Decl const*) /home/hong.gyu.kim/src/llvm/git/new/llvm/tools/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:391:0
#7 0x24a882a GetIssueHash(clang::SourceManager const*, clang::FullSourceLoc&, llvm::StringRef, llvm::StringRef, clang::Decl const*) /home/hong.gyu.kim/src/llvm/git/new/llvm/tools/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:434:0
#8 0x24a956f (anonymous namespace)::PlistDiagnostics::FlushDiagnosticsImpl(std::vector<clang::ento::PathDiagnostic const*, std::allocator<clang::ento::PathDiagnostic const*> >&, clang::ento::PathDiagnosticConsumer::FilesMade*) /home/hong.gyu.kim/src/llvm/git/new/llvm/tools/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:550:0
#9 0x249fcda clang::ento::PathDiagnosticConsumer::FlushDiagnostics(clang::ento::PathDiagnosticConsumer::FilesMade*) /home/hong.gyu.kim/src/llvm/git/new/llvm/tools/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp:449:0
...


http://reviews.llvm.org/D10305

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list