<p dir="ltr"><br>
On Aug 26, 2013 2:45 AM, "Bernd Schubert" <<a href="mailto:bernd.schubert@itwm.fraunhofer.de">bernd.schubert@itwm.fraunhofer.de</a>> wrote:<br>
><br>
> Thanks Anna,<br>
><br>
> and sorry, it was just some pseudo code I quickly wrote down. Hmm,<br>
> indeed it does report it, but it didn't for the actual code I was using.<br>
> Ah, the actual code has foo() in a different file. Is it possible to use<br>
> the analyzer with link time optimization?</p>
<p dir="ltr">Technical point: the static analyzer acts on ASTs, so lto is too late as it acts on llvm ir.</p>
<p dir="ltr">Practical point: no, theatres no cross-TU support in the static analyzer at the moment</p>
<p dir="ltr">><br>
> Thanks,<br>
> Bernd<br>
><br>
> On 08/02/2013 07:04 PM, Anna Zaks wrote:<br>
> > Bernd,<br>
> ><br>
> > The latest analyzer should warn about double frees.<br>
> ><br>
> > The code you provided does not compile, but the analyzer warns on this<br>
> > fixed code snippet:<br>
> > class my_object_t {};<br>
> > void foo(my_object_t *obj) {<br>
> > delete obj;<br>
> > }<br>
> > int foo2() {<br>
> > my_object_t *obj = new my_object_t;<br>
> > if (!obj)<br>
> > return -1;<br>
> > foo(obj);<br>
> > delete obj;<br>
> > }<br>
> ><br>
> > */Users/zaks/tmp/ex.cpp:10:2: **warning: **Attempt to free released memory*<br>
> > delete obj;<br>
> ><br>
> > Cheers,<br>
> > Anna.<br>
> > On Aug 2, 2013, at 5:09 AM, Bernd Schubert<br>
> > <<a href="mailto:bernd.schubert@itwm.fraunhofer.de">bernd.schubert@itwm.fraunhofer.de</a><br>
> > <mailto:<a href="mailto:bernd.schubert@itwm.fraunhofer.de">bernd.schubert@itwm.fraunhofer.de</a>>> wrote:<br>
> ><br>
> >> Hi all,<br>
> >><br>
> >> is there some way to instruct the static analyzer to check for double<br>
> >> deleted objects?<br>
> >><br>
> >><br>
> >> void foo(my_object_t obj)<br>
> >> {<br>
> >> delete obj;<br>
> >> }<br>
> >><br>
> >> main()<br>
> >> {<br>
> >> my_object_t *obj = new my_object_t;<br>
> >><br>
> >> if (!obj)<br>
> >> return -1;<br>
> >><br>
> >> foo(obj);<br>
> >><br>
> >> delete obj;<br>
> >> }<br>
> >><br>
> >><br>
> >> I just found something like that in my code and the static analyzer<br>
> >> hadn't detected it.<br>
> >><br>
> >><br>
> >> Thanks,<br>
> >> Bernd<br>
> >><br>
> >> _______________________________________________<br>
> >> cfe-users mailing list<br>
> >> <a href="mailto:cfe-users@cs.uiuc.edu">cfe-users@cs.uiuc.edu</a> <mailto:<a href="mailto:cfe-users@cs.uiuc.edu">cfe-users@cs.uiuc.edu</a>><br>
> >> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users</a><br>
> ><br>
><br>
> _______________________________________________<br>
> cfe-users mailing list<br>
> <a href="mailto:cfe-users@cs.uiuc.edu">cfe-users@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users</a><br>
</p>