I reverted this patch, and fix the analyzer in r92723.<br><br><div class="gmail_quote">2010/1/5 Zhongxing Xu <span dir="ltr"><<a href="mailto:xuzhongxing@gmail.com">xuzhongxing@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br><br><div class="gmail_quote"><div class="im">2010/1/5 Chris Lattner <span dir="ltr"><<a href="mailto:clattner@apple.com" target="_blank">clattner@apple.com</a>></span><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div><br><div><div></div><div class="h5">
On Jan 4, 2010, at 10:53 PM, Chandler Carruth wrote:<br>
<br>
>><br>
>> Sorry, I didn't quite understand your point. We are already asserting the<br>
>> QualType T is canonical on the entry to the method.<br>
>><br>
>> The patch makes sure the element type is canonical when we pass it to the<br>
>> method getUnqualifiedArrayType().<br>
><br>
> I think what Chris is getting at is that the element type should<br>
> already be canonical if the array type is canonical (by my reading of<br>
> getCanonicalType)?<br>
<br>
</div></div></div><div><div></div><div class="h5">Right, if an arraytype is canonical, then its element is guaranteed to be canonical.<br>
<font color="#888888"><br>
-Chris</font></div></div></blockquote><div><br>I see. I added the assertion.<br>This code still crashes clang:<br><br>$ clang -cc1 -analyze -checker-cfref crash.c<br><br> #include <string.h><br>typedef unsigned char Byte;<br>
void doit (char *data, int len) {<br>
    if (len) {<br>        Byte buf[len];<br>        memcpy(buf, data, len);<br>    }<br>}<br><br><br>The problem is that the canonical type of type 'Byte' is itself. <br></div></div>
</blockquote></div><br>