[cfe-commits] r92318 - /cfe/trunk/lib/AST/ASTContext.cpp

Zhongxing Xu xuzhongxing at gmail.com
Tue Jan 5 00:17:02 PST 2010


2010/1/5 Chris Lattner <clattner at apple.com>

>
> On Jan 4, 2010, at 10:53 PM, Chandler Carruth wrote:
>
> >>
> >> Sorry, I didn't quite understand your point. We are already asserting
> the
> >> QualType T is canonical on the entry to the method.
> >>
> >> The patch makes sure the element type is canonical when we pass it to
> the
> >> method getUnqualifiedArrayType().
> >
> > I think what Chris is getting at is that the element type should
> > already be canonical if the array type is canonical (by my reading of
> > getCanonicalType)?
>
> Right, if an arraytype is canonical, then its element is guaranteed to be
> canonical.
>
> -Chris


I see. I added the assertion.
This code still crashes clang:

$ clang -cc1 -analyze -checker-cfref crash.c

 #include <string.h>
typedef unsigned char Byte;
void doit (char *data, int len) {
    if (len) {
        Byte buf[len];
        memcpy(buf, data, len);
    }
}


The problem is that the canonical type of type 'Byte' is itself.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100105/d01fd275/attachment.html>


More information about the cfe-commits mailing list