[cfe-dev] RFC on array-bounds patch

Daniel Marjamäki Daniel.Marjamaki at evidente.se
Mon Feb 17 10:29:23 PST 2014


Hello!

Here is a patch that will make Clang warn when there is this index out of bounds:

    void f(int x) {
        int a[10];
        if (x >= 10)
            a[x] = x;
    }

The checkLocation is not triggered on the "a[x] = x;" statement. Is this by design? Is the checkPrestmt a good choice or would it be better to choose some other check type?

Best regards,
Daniel Marjamäki

..................................................................................................................
Daniel Marjamäki Senior Engineer
Evidente ES East AB  Warfvinges väg 34  SE-112 51 Stockholm  Sweden

Mobile:                 +46 (0)709 12 42 62
E-mail:                 Daniel.Marjamaki<mailto:Daniel.Marjamaki at evidente.se>@evidente.se<mailto:Daniel.Marjamaki at evidente.se>

www.evidente.se
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140217/214395d2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: array-bounds.patch
Type: text/x-patch
Size: 1590 bytes
Desc: array-bounds.patch
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140217/214395d2/attachment.bin>


More information about the cfe-dev mailing list