[cfe-commits] r59931 - /cfe/trunk/test/Analysis/outofbound.c

Zhongxing Xu xuzhongxing at gmail.com
Sun Nov 23 20:57:05 PST 2008


On Mon, Nov 24, 2008 at 12:29 PM, Chris Lattner <clattner at apple.com> wrote:

>
> On Nov 23, 2008, at 6:19 PM, Zhongxing Xu wrote:
>
>  Author: zhongxingxu
>> Date: Sun Nov 23 20:19:49 2008
>> New Revision: 59931
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=59931&view=rev
>> Log:
>> Add test case for out-of-bound memory access checking.
>>
>> Added:
>>   cfe/trunk/test/Analysis/outofbound.c
>>
>> Added: cfe/trunk/test/Analysis/outofbound.c
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/outofbound.c?rev=59931&view=auto
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> ======================================================================
>> --- cfe/trunk/test/Analysis/outofbound.c (added)
>> +++ cfe/trunk/test/Analysis/outofbound.c Sun Nov 23 20:19:49 2008
>> @@ -0,0 +1,6 @@
>> +// RUN: clang -checker-simple -analyzer-store-region -verify %s
>> +
>> +char f1() {
>> +  char* s = "abcd";
>> +  return s[4]; // expected-warning{{Load or store into an out-of-bound
>> memory position.}}
>> +}
>>
>
> Hi Zhongxing,
>
> This is valid code - strings in C are null terminated, so this always
> returns '\0'.
>

Oh, sorry. My mistake. I'll correct the logic.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20081124/4abd5ff8/attachment.html>


More information about the cfe-commits mailing list