Re: [PATCH] src/sort.c: assert on temp.text before calling memcpy()

2010-01-06 Thread Kamil Dudka
Hey, On Tue January 5 2010 21:01:13 Kovarththanan Rajaratnam wrote: > clang detected the following false positive: > > sort.c:2292:7: warning: Null pointer passed as an argument to a 'nonnull' > parameter memcpy (temp.text, line->text, line->length); how can I force clang to issue the warning?

Re: [PATCH] src/sort.c: assert on temp.text before calling memcpy()

2010-01-06 Thread Kovarththanan Rajaratnam
Pádraig Brady wrote: > That looks wrong. > Should memcpy() be marked as nonnull as the length can be 0? That doesn't matter: C99 7.21.1#2 "Where an argument declared as size_t n specifies the length of the array for a function, n can have the value zero on a call to that function. Unless explicitl

Re: [PATCH] src/sort.c: assert on temp.text before calling memcpy()

2010-01-06 Thread Pádraig Brady
On 06/01/10 11:16, Kovarththanan Rajaratnam wrote: Pádraig Brady wrote: That looks wrong. Should memcpy() be marked as nonnull as the length can be 0? That doesn't matter: C99 7.21.1#2 "Where an argument declared as size_t n specifies the length of the array for a function, n can have the valu

Re: [PATCH] src/sort.c: assert on temp.text before calling memcpy()

2010-01-06 Thread Pádraig Brady
That looks wrong. Should memcpy() be marked as nonnull as the length can be 0? In any case we don't want to be asserting in such cases, rather just doing: if (temp.text) memcpy (...)