[LLVMbugs] [Bug 16731] New: Static analyzer does not track pointer values across memcpy

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jul 29 06:32:36 PDT 2013


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

            Bug ID: 16731
           Summary: Static analyzer does not track pointer values across
                    memcpy
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: labath at google.com
                CC: klimek at google.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

$ cat leak.c
#include <stdlib.h>

char *f() {
  void *x = malloc(47);
  char *a;
  memcpy(&a, &x, sizeof a);
  return a;
}
$ clang --analyze leak.c
leak.c:7:3: warning: Potential leak of memory pointed to by 'x'
  return a;
  ^~~~~~~~
1 warning generated.


This warning should not be reported, as the allocated memory is still
accessible using the return value of the function.

-- 
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/20130729/37a44e38/attachment.html>


More information about the llvm-bugs mailing list