[PATCH] don't diagnose -Wchar-subscript for safe char literal

Richard Smith richard at metafoo.co.uk
Wed Apr 23 10:52:18 PDT 2014


On Wed, Apr 23, 2014 at 10:39 AM, Jordan Rose <jordan_rose at apple.com> wrote:

> This disables the warning on this case too, which doesn't get the
> out-of-bounds warning:
>
> char test(char *foo) {
> return foo['\xFF'];
> }
>
> Is that okay?
>

Ugh. It's definitely not ideal. (We don't warn for foo[-1] either, but in
that case it's much more obvious that your subscript is negative.)

I think we should reinstate the warning for this case.


> On Apr 21, 2014, at 18:04 , Richard Smith <richard at metafoo.co.uk> wrote:
>
> LGTM
>
>
> On Fri, Apr 18, 2014 at 5:54 AM, Daniel Marjamäki <
> Daniel.Marjamaki at evidente.se> wrote:
>
>> Hello!
>>
>> I added a -triple.
>>
>> Is this correct? I don't see any change in output.
>>
>> 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 at evidente.se
>>
>> www.evidente.se
>>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140423/77eb628e/attachment.html>


More information about the cfe-commits mailing list