<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 14, 2016, at 5:26 AM, Aaron Ballman via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">On Wed, Jan 13, 2016 at 12:57 AM, Yury Gribov via cfe-dev</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><</span><a href="mailto:cfe-dev@lists.llvm.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">cfe-dev@lists.llvm.org</a><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">> wrote:</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">On 01/13/2016 04:20 AM, <Alexander G. Riccio> via cfe-dev wrote:<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><br class="">My understanding is that this is in the “unix” package for historical<br class=""></blockquote><br class="">reasons from before the analyzer thought about Windows. We have clients<br class="">that rely on the malloc checker being enabled/disabled with ‘unix.Malloc'<br class="">so moving it will break compatibility.<br class=""><br class="">Gahh, ok. Not breaking things is a good reason.<br class=""></blockquote><br class=""><br class="">Why not implement checker synonyms? This sounds like a general problem.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">This is what clang-tidy did for its checkers, and it seems like the</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">static analyzer could maybe benefit from the same feature. I can</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">foresee use for such a thing if, for instance, people wanted to add</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">static analysis checks for various coding guidelines that have</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">overlapping requirements.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div><div>This would definitely be valuable.</div><br class=""><blockquote type="cite" class=""><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">~Aaron</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">I discussed this off-list with Anna Zaks. She recommended changing the<br class=""></blockquote><br class="">driver to enable unix.Malloc explicitly when running in a Windows MSVC<br class="">environment. This is Clang::ConstructJob() in Tools.cpp. We currently skip<br class="">enabling the “unix” package there for Windows MSVC.<br class=""><br class="">Yup, that'd be a good short term fix.<br class=""><br class=""><blockquote type="cite" class="">Someone who develops on Windows should write a patch and test it.<br class=""></blockquote><br class="">Alexander: would you be willing to do this? It should be very<br class="">straightforward — there is similar code to disable specific checkers for<br class="">PS4.<br class=""><br class="">Yup! I could very well do that. I think the change would look something<br class="">like:<br class=""><br class="">if (!IsWindowsMSVC)<br class="">        CmdArgs.push_back("-analyzer-checker=unix.Malloc");<br class=""><br class=""><blockquote type="cite" class="">We should also add a comment Checkers.td to indicate that we should move<br class=""></blockquote><br class="">the Malloc checker to another package when we do remap packages names and<br class="">break backward compatibility. “core” is probably not the right place for<br class="">this (since malloc() is in the standard library). Maybe a new “cstdlib”<br class="">package?<br class=""><br class="">(that's what I meant by "short term fix")<br class="">"cstdlib" makes more sense - core was just the first thing that came to<br class="">mind - and we could make cstdlib.malloc/cstdlib.Malloc alias unix.Malloc<br class="">to<br class="">avoid breaking users of unix.Malloc.<br class=""><br class="">Sidenote: has anybody ever considered diagnosing incorrectly capitalized<br class="">checker name arguments? It's not terribly important, but I was quite<br class="">annoyed to find out that I'd spent a couple hours debugging a lowercase<br class="">"M".<br class=""><br class="">Sincerely,<br class="">Alexander Riccio<br class="">--<br class="">"Change the world or go home."<br class=""><a href="http://about.me/ariccio" class="">about.me/ariccio</a><br class=""><br class=""><http://about.me/ariccio><br class=""><br class="">If left to my own devices, I will build more.<br class="">⁂<br class=""><br class="">On Tue, Jan 12, 2016 at 7:06 PM, Devin Coughlin <dcoughlin@apple.com><br class="">wrote:<br class=""><br class=""><blockquote type="cite" class="">My understanding is that this is in the “unix” package for historical<br class="">reasons from before the analyzer thought about Windows. We have clients<br class="">that rely on the malloc checker being enabled/disabled with ‘unix.Malloc'<br class="">so moving it will break compatibility.<br class=""><br class="">I discussed this off-list with Anna Zaks. She recommended changing the<br class="">driver to enable unix.Malloc explicitly when running in a Windows MSVC<br class="">environment. This is Clang::ConstructJob() in Tools.cpp. We currently<br class="">skip<br class="">enabling the “unix” package there for Windows MSVC.<br class=""><br class="">Someone who develops on Windows should write a patch and test it.<br class="">Alexander: would you be willing to do this? It should be very<br class="">straightforward — there is similar code to disable specific checkers for<br class="">PS4.<br class=""><br class="">We should also add a comment Checkers.td to indicate that we should move<br class="">the Malloc checker to another package when we do remap packages names and<br class="">break backward compatibility. “core” is probably not the right place for<br class="">this (since malloc() is in the standard library). Maybe a new “cstdlib”<br class="">package?<br class=""><br class="">Devin<br class=""><br class="">On Jan 12, 2016, at 2:22 PM, Alexander Riccio via cfe-dev <<br class="">cfe-dev@lists.llvm.org> wrote:<br class=""><br class="">Shoot - I haven't responded to this. I did some debugging the other day<br class="">and found that if I manually pass the flag to enable the unix.Malloc<br class="">checker (that's a capital "M", as I discovered the hard way), Clang<br class="">detects<br class="">this.<br class=""><br class="">I was going to suggest something like enabling it by default (obvious),<br class="">and *maybe* renaming it to something like core.Malloc, because it's not<br class="">unix-specific.<br class=""><br class="">The one benefit here of parsing SAL is a more generic mechanism, but<br class="">that's a different issue.<br class=""><br class="">sent from my (stupid) windows phone<br class="">------------------------------<br class="">From: Reid Kleckner <rnk@google.com><br class="">Sent: ‎1/‎12/‎2016 5:18 PM<br class="">To: <Alexander G. Riccio> <test35965@gmail.com>; Jordan Rose<br class=""><jordan_rose@apple.com><br class="">Cc: cfe-dev <cfe-dev@lists.llvm.org><br class="">Subject: Re: [cfe-dev] Clang on Windows fails to detect trivial double<br class="">free instatic analysis<br class=""><br class="">Jordan, how do we enable this checker on Windows?<br class=""><br class="">We shouldn't need to be able to parse SAL to do this analysis.<br class=""><br class="">On Sun, Jan 3, 2016 at 10:31 PM, <Alexander G. Riccio> via cfe-dev <<br class="">cfe-dev@lists.llvm.org> wrote:<br class=""><br class=""><blockquote type="cite" class="">Is it because the checker is *unix*.malloc<br class=""><http://clang-analyzer.llvm.org/available_checks.html#unix_checkers>? If<br class="">so, that's actually quite terrible... why only check it on unix??<br class=""><br class="">Sincerely,<br class="">Alexander Riccio<br class="">--<br class="">"Change the world or go home."<br class="">about.me/ariccio<br class=""><br class=""><http://about.me/ariccio><br class="">If left to my own devices, I will build more.<br class="">⁂<br class=""><br class="">On Sat, Jan 2, 2016 at 3:57 PM, <Alexander G. Riccio> <<br class="">test35965@gmail.com> wrote:<br class=""><br class=""><blockquote type="cite" class="">When I build the attached C program in windows, using Clang built from<br class="">a<br class="">very recent tree version (trunk 256686), Clang fails to detect the<br class="">trivial<br class="">double free, as evidenced in the resulting plist file (attached).<br class=""><br class="">What's going on here? I have a gut feeling that it has something to do<br class="">with Clang's ignorance of SAL, which allows MSVC to detect the<br class="">condition<br class="">generically:<br class=""><br class="">void __cdecl free(<br class="">    _Pre_maybenull_ _Post_invalid_ void* _Block<br class="">    );<br class=""><br class="">(from C:/Program Files (x86)/Windows<br class="">Kits/10/Include/10.0.10240.0/ucrt/corecrt_malloc.h)<br class=""><br class="">I'm also attaching the verbose compilation output.<br class=""><br class="">Sincerely,<br class="">Alexander Riccio<br class="">--<br class="">"Change the world or go home."<br class="">about.me/ariccio<br class=""><br class=""><http://about.me/ariccio><br class="">If left to my own devices, I will build more.<br class="">⁂<br class=""><br class=""></blockquote><br class=""><br class="">_______________________________________________<br class="">cfe-dev mailing list<br class="">cfe-dev@lists.llvm.org<br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev<br class=""><br class=""><br class=""></blockquote>_______________________________________________<br class="">cfe-dev mailing list<br class="">cfe-dev@lists.llvm.org<br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev<br class=""><br class=""><br class=""><br class=""></blockquote><br class=""><br class=""><br class="">_______________________________________________<br class="">cfe-dev mailing list<br class="">cfe-dev@lists.llvm.org<br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev<br class=""><br class=""></blockquote><br class="">_______________________________________________<br class="">cfe-dev mailing list<br class=""><a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev<br class=""></blockquote><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">cfe-dev mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:cfe-dev@lists.llvm.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">cfe-dev@lists.llvm.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a></div></blockquote></div><br class=""></body></html>