<div dir="ltr">Thank you! I will investigate how to implement that.<div><br></div><div>As a dirty hack, will it be fine to simply ignore typeid() as follows? There aren't many calls to it in our code base.</div><div>case Stmt::CXXTypeidExprClass:</div><div> break; <br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 10 Jun 2019 at 19:38, Artem Dergachev <<a href="mailto:noqnoqneo@gmail.com">noqnoqneo@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
Yes, indeed, this is simply unimplemented. Like, so much
unimplemented that the analyzer is unable to figure out how to
handle CXXTypeidExpr so it gives up on the current execution path.
See ExprEngine::Visit, the top part of the switch.<br>
<br>
It shouldn't be that hard to implement in a reasonable manner. I
guess, the values that it returns would always be symbolic (as in,
an invalidated structure), but consistent as long as we know the
type (and it should probably produce a new value every time we don't
know the type on the current path).<br>
<br>
<div class="gmail-m_3402060936141726367moz-cite-prefix">On 6/10/19 6:26 PM, Torry Chen via
cfe-dev wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Hi all,<br>
<br>
I've been using the unix.Malloc checker to detect memory
management issues in our code base. But we found the checker
seems to stop exploring after seeing a call to typeid(). Below
is a bad code example and unix.Malloc should warn about a
double-free. But if I uncomment the line calling typeid(), the
checker doesn't report any bug.<br>
<br>
This prevents it from checking some of our templated functions
that call typeid(). Could someone please let me know why this
happens and how do I make the checker continue to work after
seeing typeid()?<br>
<br>
Thank you!<br>
Torry<br>
<br>
<font face="courier new, monospace">void double_free(int size) {<br>
char *data = (char *)malloc(size);<br>
<br>
for (int i = 0; i < size; i++)<br>
data[i] = i;<br>
<br>
// auto tname = typeid(uint64_t).name(); // typeid() seems
to stop analyzer<br>
// printf("Type name is %s\n", tname);<br>
<br>
free(data);<br>
free(data); // Should warn: Attempt to free released memory<br>
}<br>
<br>
int main(int argc, char** argv) {<br>
double_free(argc);<br>
<br>
return 0;<br>
}</font><br>
</div>
<br>
<fieldset class="gmail-m_3402060936141726367mimeAttachmentHeader"></fieldset>
<pre class="gmail-m_3402060936141726367moz-quote-pre">_______________________________________________
cfe-dev mailing list
<a class="gmail-m_3402060936141726367moz-txt-link-abbreviated" href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>
<a class="gmail-m_3402060936141726367moz-txt-link-freetext" href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a>
</pre>
</blockquote>
<br>
</div>
</blockquote></div>