On Sep 22, 2012, at 21:00 , Sean McBride <[email protected]> wrote:

> On Fri, 21 Sep 2012 09:51:32 -0700, Jordan Rose said:
> 
>> The reallocf change looks good. The place to add a test is unix-fns.c,
>> which you probably already found. I'll let you come up with a test case
>> just to practice. ;-) Welcome to the static analyzer!
> 
> I did find that, and also tools/clang/test/Analysis/malloc.c which has 
> functions named reallocSizeZero1, reallocSizeZero2, etc.  Should I make 
> reallocf() versions of those too?

Hm. The two files are actually testing different checkers, and the change 
you're making won't change the behavior tested in malloc.c.

Stepping back, those functions are intended to test Linux's realloc behavior, 
which frees the memory and may return NULL when the size is 0. Clearly there 
are problems there. :-) But the checker is trying to support that particular 
idiom on Linux, and people who depend on it may want to disable the 
UnixAPIChecker without disabling MallocChecker.

So I think just unix-fns.c is okay for this change. We do already have some 
independent reallocf tests in malloc.c.

Thanks, Sean!
Jordan
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to