On 10/24/2018 06:24 AM, Joseph Myers wrote:
On Wed, 24 Oct 2018, Martin Sebor wrote:

/* The compiler will optimize based on the knowledge the parameter is
   not NULL.  This will omit tests.  A robust implementation cannot allow
   this so when compiling glibc itself we ignore this attribute.  */
# undef __nonnull
# define __nonnull(params)

I don't think this is actually true for recent versions of GCC.
The nonnull optimization is controlled by
-fisolate-erroneous-paths-attribute and according to the manual
and common.opt the option is disabled by default.

I think -fisolate-erroneous-paths-attribute controls something different
(generating tests and traps rather than simply optimizing on the basis of
a parameter not being NULL).

You're right, the option that does what I was thinking of is
-fdelete-null-pointer-checks and that one is enabled by default.
I should update the description of the attribute to mention this.

Martin

Reply via email to