[LLVMbugs] [Bug 23425] New: unix.Malloc and cplusplus.NewDeleteLeaks doesn't report leaks in functions declared in header files.
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue May 5 16:09:24 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=23425
Bug ID: 23425
Summary: unix.Malloc and cplusplus.NewDeleteLeaks doesn't
report leaks in functions declared in header files.
Product: clang
Version: trunk
Hardware: PC
OS: Windows XP
Status: NEW
Severity: normal
Priority: P
Component: Static Analyzer
Assignee: kremenek at apple.com
Reporter: anton.yartsev at Gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Symptoms: the analyzer doesn't report a leak in a given case:
>cat header.h
void f();
>cat test.cpp
#include "header.h"
void f() {
int *p = new int;
}
>clang -cc1 -analyzer-checker=cplusplus.NewDeleteLeaks test.cpp
Adding an option '-analyzer-opt-analyze-headers' makes analyzer report a
warning:
>clang -cc1 -analyzer-checker=cplusplus.NewDeleteLeaks -analyzer-opt-analyze-headers -analyze test.cpp
test.cpp:5:1: warning: Potential leak of memory pointed to by 'p'
}
^
1 warning generated.
Clang help for -analyzer-opt-analyze-headers says that an option 'Force the
static analyzer to analyze functions defined in header files', but in the test
above the function is defined in the cpp file.
The deadcode.DeadStores checker reports an error regardless of whether
-analyzer-opt-analyze-headers was passed or not:
>clang -cc1 -analyzer-checker=deadcode.DeadStores -analyze test.cpp
test.cpp:4:8: warning: Value stored to 'p' during its initialization is never
read
int *p = new int;
^ ~~~~~~~
1 warning generated.
--
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/20150505/8253733e/attachment.html>
More information about the llvm-bugs
mailing list