[cfe-dev] Clang on Windows fails to detect trivial double free instatic analysis
Jordan Rose via cfe-dev
cfe-dev at lists.llvm.org
Tue Jan 12 14:35:52 PST 2016
+Devin, +Anna. I don't really work on the analyzer anymore, so I don't want to comment on whether this makes sense. (I don't have any knowledge to add.)
> On Jan 12, 2016, at 14:22, Alexander Riccio <test35965 at gmail.com> wrote:
>
> Shoot - I haven't responded to this. I did some debugging the other day and found that if I manually pass the flag to enable the unix.Malloc checker (that's a capital "M", as I discovered the hard way), Clang detects this.
>
> I was going to suggest something like enabling it by default (obvious), and *maybe* renaming it to something like core.Malloc, because it's not unix-specific.
>
> The one benefit here of parsing SAL is a more generic mechanism, but that's a different issue.
>
> sent from my (stupid) windows phone
> From: Reid Kleckner <mailto:rnk at google.com>
> Sent: 1/12/2016 5:18 PM
> To: <Alexander G. Riccio> <mailto:test35965 at gmail.com>; Jordan Rose <mailto:jordan_rose at apple.com>
> Cc: cfe-dev <mailto:cfe-dev at lists.llvm.org>
> Subject: Re: [cfe-dev] Clang on Windows fails to detect trivial double free instatic analysis
>
> Jordan, how do we enable this checker on Windows?
>
> We shouldn't need to be able to parse SAL to do this analysis.
>
> On Sun, Jan 3, 2016 at 10:31 PM, <Alexander G. Riccio> via cfe-dev <cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>> wrote:
> Is it because the checker is unix.malloc <http://clang-analyzer.llvm.org/available_checks.html#unix_checkers>? If so, that's actually quite terrible... why only check it on unix??
>
> Sincerely,
> Alexander Riccio
> --
> "Change the world or go home."
> about.me/ariccio <http://about.me/ariccio>
>
> <http://about.me/ariccio>
> If left to my own devices, I will build more.
> ⁂
>
> On Sat, Jan 2, 2016 at 3:57 PM, <Alexander G. Riccio> <test35965 at gmail.com <mailto:test35965 at gmail.com>> wrote:
> When I build the attached C program in windows, using Clang built from a very recent tree version (trunk 256686), Clang fails to detect the trivial double free, as evidenced in the resulting plist file (attached).
>
> What's going on here? I have a gut feeling that it has something to do with Clang's ignorance of SAL, which allows MSVC to detect the condition generically:
>
> void __cdecl free(
> _Pre_maybenull_ _Post_invalid_ void* _Block
> );
> (from C:/Program Files (x86)/Windows Kits/10/Include/10.0.10240.0/ucrt/corecrt_malloc.h)
>
> I'm also attaching the verbose compilation output.
>
> Sincerely,
> Alexander Riccio
> --
> "Change the world or go home."
> about.me/ariccio <http://about.me/ariccio>
>
> <http://about.me/ariccio>
> If left to my own devices, I will build more.
> ⁂
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160112/9f7d0744/attachment.html>
More information about the cfe-dev
mailing list