Defeat compiler optimization which assumes function addresses are never NULL

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Thu Sep 29 05:29:12 UTC 2011


On Sep 29, 2011 6:16 AM, "Kevin Day" <thekevinday at gmail.com> wrote:
>
> For the commit
http://git.uclibc.org/uClibc/commit/?id=82f8d0bce10403deab704871e638edc24e7933ee
>
> Would it be better to pass "-fno-delete-null-pointer-checks"?
> I suspect that is the optimization issue, but I could easily be wrong.
>
> gcc documentation has the following about that option:
> -fdelete-null-pointer-checks
>    "Assume that programs cannot safely dereference null pointers, and
> that no code or data element resides there."
>  ...
I think thisdid not work, but please try if it does for you. Note, however,
that
1) it is fixed in gcc-4.7
2) I sent a gcc patch for earlier versions (<4.7)
3) that not_null_ptr works around it size-neutral

I.e. I consider this problem fixed.


More information about the uClibc mailing list