[cfe-commits] [cfe-dev] How to fix null-deref-ps.c on FreeBSD?

Ben Laurie benl at google.com
Tue Feb 17 09:37:06 PST 2009


On Tue, Feb 17, 2009 at 4:45 PM, Ted Kremenek <kremenek at apple.com> wrote:
> Hi Ben,
>
> The analyzer knows that all functions with the 'noreturn' attribute don't
> return.  What does the assert macro expand to on FreeBSD?

The problem is that __assert does not have noreturn set on FreeBSD.
I'm in the process of getting that fixed - but as an apprentice
FreeBSD committer that's probably harder for me than anyone else, so
it may take a while :-)

In the meantime, I think the right answer is for me to patch
/usr/include/assert.h.

>
> On Feb 17, 2009, at 7:08 AM, Ben Laurie wrote:
>
>> This test fails on FreeBSD, and the following patch fixes it:
>>
>> Index: test/Analysis/null-deref-ps.c
>> ===================================================================
>> --- test/Analysis/null-deref-ps.c       (revision 64762)
>> +++ test/Analysis/null-deref-ps.c       (working copy)
>> @@ -129,6 +129,8 @@
>>
>> int* qux();
>>
>> +void __assert(const char *, const char *, int, const char *)
>> __attribute__((__noreturn__));
>> +
>> int f9(unsigned len) {
>>  assert (len != 0);
>>  int *p = 0;
>>
>> the problem being, of course, that the analyzer has to understand that
>> a failed assert does not return...
>>
>> But how would I go about fixing this properly?
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>



More information about the cfe-commits mailing list