https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110617

--- Comment #12 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
(In reply to Florian Weimer from comment #11)
> (In reply to Xi Ruoyao from comment #10)
> > But Zack's reason against using __nonnull is __nonnull may cause unwanted
> > optimizations to *the user code*.
> 
> GCC already offers options to control function call behavior in the presence
> of nonnull attributes:
> 
>      For function calls:
>         • If the compiler determines that a null pointer is passed in an
>           argument slot marked as non-null, and the ‘-Wnonnull’ option
>           is enabled, a warning is issued.  *Note Warning Options::.
>         • The ‘-fisolate-erroneous-paths-attribute’ option can be
>           specified to have GCC transform calls with null arguments to
>           non-null functions into traps.  *Note Optimize Options::.
>         • The compiler may also perform optimizations based on the
>           knowledge that certain function arguments cannot be null.
>           These optimizations can be disabled by the
>           ‘-fno-delete-null-pointer-checks’ option.  *Note Optimize
>           Options::.
> 
> So I don't think we need another way to disable nonnull attributes in
> installed glibc headers.

Ah indeed, I only remembered "-fisolate-erroneous-paths-attribute" but not
"-fno-delete-null-pointer-checks".

Reply via email to