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

Alexei Svitkine alexei.svitkine at gmail.com
Tue Feb 17 10:42:47 PST 2009

If a panic function is in user code, is the analyzer smart enough to
figure out that function never returns by looking at the code (ie all
branches lead to _exit() or another panic function)?

If not, I think this should be added. (Obviously this doesn't work for
library panic functions...)


On Tue, Feb 17, 2009 at 12:52 PM, Ted Kremenek <kremenek at apple.com> wrote:
> On Feb 17, 2009, at 9:49 AM, Ben Laurie 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.
>>> __assert isn't the only "panic" function that isn't marked with
>>> noreturn.
>>> Since it occurs so frequently, I can just add it to the list of
>>> hard-coded
>>> functions that the analyzer knows about.
>> I wondered if such a thing existed. Where is it?
> It's this hackish blob of code in GRExprEngine.cpp.  Search for
> "panic".  Eventually this code will get reworked to be less hackish,
> but we will always have to maintain a list of some of these functions
> somewhere.
> I just added "_assert" to that list:
> http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090216/012556.html
> It joins the ranks of functions such as _assert_rtn, _assert_fail,
> dtrace_assfail and friends.
> _______________________________________________
> 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