[Bug ipa/108871] attribute nonnull does not spot nullptr O2 and above when function inlined
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Feb 23 16:21:19 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108871
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #3)
> *** Bug 108893 has been marked as a duplicate of this bug. ***
N.B. this one is about __attribute__((access(read_only, 1))) not nonnull. The
docs already seem to imply that it requires a non-null pointer:
The read_only access mode specifies that the pointer to which it applies is
used to
read the referenced object but not write to it. Unless the argument
specifying the
size of the access denoted by size-index is zero, the referenced object must
be
initialized.
If a non-zero size implies an initialized object, then it also implies a
non-null pointer (since a null pointer doesn't point to an initialized object).
I don't know if we want this PR to be specific to the nonnull attribute, or if
it makes sense to use it for access(read_only) too.
More information about the Gcc-bugs
mailing list