public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/108871] attribute nonnull does not spot nullptr O2 and above when function inlined
Date: Thu, 23 Feb 2023 16:39:25 +0000	[thread overview]
Message-ID: <bug-108871-4-9eldgwYgaV@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108871-4@http.gcc.gnu.org/bugzilla/>

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #5)
> (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.

On the other side, looking at glibc sources, access attributes there are used
on many functions together with nonnull attributes for the same arguments and
in many cases in places where there are not nonnull attributes.  So, making
access attribute imply non-null might not be desirable in real-world unless it
is already implied.
So it might be just that it is badly documented.

  parent reply	other threads:[~2023-02-23 16:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-21 14:53 [Bug c++/108871] New: " jg at jguk dot org
2023-02-21 14:54 ` [Bug c++/108871] " jg at jguk dot org
2023-02-22  8:31 ` [Bug ipa/108871] " rguenth at gcc dot gnu.org
2023-02-22 20:31 ` pinskia at gcc dot gnu.org
2023-02-23 12:28 ` jg at jguk dot org
2023-02-23 16:21 ` redi at gcc dot gnu.org
2023-02-23 16:39 ` jakub at gcc dot gnu.org [this message]
2023-02-24 22:35 ` jg at jguk dot org
2023-03-03 20:54 ` jg at jguk dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-108871-4-9eldgwYgaV@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).