https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108893
--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Jonny Grant from comment #8) > So the caveat is this issue (2). I can't use attribute nonnull due to these > optimizations that cannot be disabled. But you declare that argument cannot be null. So why keep around a check for it being null. The nonnull attribute is basically saying there is a requirement for it being nonnull no matter what. It basically says if a null is passed undefined behavior happens.