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: [email protected]
Reporter: [email protected]
CC: [email protected]
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs