[LLVMbugs] [Bug 19827] New: Clang static analyzer reports different line numbers in command line vs. html file.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu May 22 09:23:22 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=19827

            Bug ID: 19827
           Summary: Clang static analyzer reports different line numbers
                    in command line vs. html file.
           Product: clang
           Version: 3.4
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: hiraditya at msn.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

cat test.cpp

unsigned int *gp;
int foo(unsigned int argc) {
  int* p = new int[10];
  unsigned int i = 100;
  gp = &i;
  if (argc>*p)
    return i;
  return *p;
}


clang++ -cc1 -analyze -analyzer-checker=security,unix,core,alpha
-analyzer-output html -o report-dir/ -x c++ test.cpp

------------------Command line output----------------------
test.cpp:13:3: warning: Potential leak of memory pointed to by 'p'
  return *p;
  ^~~~~~~~~
test.cpp:14:1: warning: Address of stack memory associated with local variable
'i' is still referred to by the global variable 'gp' upon returning to the
caller.  This will be a dangling reference
}

--------------------html output------------------
Bug Summary
File:    test.cpp
Location:    line 12, column 12 <------- vs. 13:1 from the command line
Description:    Potential leak of memory pointed to by 'p'

-- 
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/20140522/22ba2430/attachment.html>


More information about the llvm-bugs mailing list