[cfe-dev] Find (memory) bugs over multiple translation units (files) in C
Florian Scheibner
florian.scheibner at mytum.de
Sat Feb 8 03:27:36 PST 2014
Hello,
I want to be able to track memory bugs, e.g double frees over multiple
C-files. When one function allocates memory and passes the pointer to
another function in another file, then a double free is not found anymore.
Example
file1.c:
#include <stdlib.h>
#include "file2.h"
int main(int argc, void** argv) {
void* p = malloc(1);
foo(p);
free(p);
}
file2.c:
#include <stdlib.h>
void foo(void* p) {
free(p);
}
file2.h:
void foo(void* p);
There have been some question on this previously:
http://permalink.gmane.org/gmane.comp.compilers.clang.devel/23626
http://permalink.gmane.org/gmane.comp.compilers.clang.devel/17310
Has anything changed since then?
Also wouldn't it be possible to just merge the different ASTs together
and analyze the program as a whole?
Is there a specific reason why this hasn't been implemented? If it is
not too big a task I could extend clang for this scenario as part of my
bachelor's thesis.
I'm looking forward to your insights.
Thank you very much in advance
Florian Scheibner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4243 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140208/2de84319/attachment.bin>
More information about the cfe-dev
mailing list