public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Tom Tromey <tom@tromey.com>
Cc: Jan-Benedict Glaw <jbglaw@lug-owl.de>,
	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	Andrew Burgess <andrew.burgess@embecosm.com>
Subject: Re: [gdb/build] Fix Werror=nonnull-compare build breaker with gcc 12
Date: Thu, 29 Jul 2021 00:32:11 +0200	[thread overview]
Message-ID: <f4d65b40-364c-d73b-d224-4c878cc8716f@suse.de> (raw)
In-Reply-To: <f898e9fb-d9a5-e294-483c-15542015248c@suse.de>

[ quote-copied from
https://sourceware.org/pipermail/gdb-patches/2021-July/181173.html. I
didn't get this email in either my inbox or gdb-patches folder. ]

> Tom> I managed now to reproduce, and wrote a patch along these lines.
> 
> Tom> Any comments?
> 
> Tom> In particular, any suggestion where to put ignore_nonnull?
> 
> Tom> Or, is it perhaps a better idea to have a gdb_assert_nonnull and
> Tom> implement things there?
> 

Thanks for giving your take on this.

> How about we either drop the nonnull attribute

That's a possibility indeed.

> or we use
> -fno-delete-null-pointer-checks?
> 

Unfortunately, that doesn't work (and it took me some hours today to
realize and understand).  I've submitted a patch to improved the nonnull
documentation (
https://gcc.gnu.org/pipermail/gcc-patches/2021-July/576218.html ),
hopefully it should be clear from there that
-fno-delete-null-pointer-checks doesn't disable the optimization we're
having trouble with.

> I personally feel that the gcc approach in this area is
> counter-productive, at least for our purposes.  My view is that the
> point of this stuff is to help us detect programming errors -- and we're
> uninterested in using non-null-ness as some kind of optimization hint.
> gcc seems to want it both ways, which seems bizarre.

I think they just implemented two attributes: assume_nonnull and
verify_nonnull as a single attribute nonnull.  Then still that could be
workable, but eventually the problem is that you can't switch the two
interpretations on and off in a reasonable manner.

> But, given that
> this is how the compiler works, IMO we should choose reliability
> whichever way we best can.

Yes, I hope to get some reasonable feedback, but I'm not holding my
breath.  So we could possibly end up with dropping nonnull.

Thanks,
- Tom

  parent reply	other threads:[~2021-07-28 22:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210726211101.ivychvbfgaafxjtz@lug-owl.de>
     [not found] ` <20210727100354.GB4037238@embecosm.com>
     [not found]   ` <b29d9d0b-f847-c0a0-9f09-d42d0f5e91df@suse.de>
     [not found]     ` <20210727113511.GC4037238@embecosm.com>
     [not found]       ` <6cf80ba9-b010-bb42-c92d-84e4f396813c@suse.de>
     [not found]         ` <b4da20e9-69a0-8b92-606d-ddf858539a66@suse.de>
2021-07-27 16:28           ` Tom de Vries
2021-07-28  9:28             ` Andrew Burgess
2021-07-28 15:31               ` Tom de Vries
2021-07-28 16:15             ` Tom Tromey
2021-07-28 22:32             ` Tom de Vries [this message]
2021-07-29 11:42               ` [master + 11][gdb/build] Disable attribute nonnull Tom de Vries
2021-07-29 17:30                 ` Tom Tromey
2021-07-30 10:16                 ` Andrew Burgess

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=f4d65b40-364c-d73b-d224-4c878cc8716f@suse.de \
    --to=tdevries@suse.de \
    --cc=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jbglaw@lug-owl.de \
    --cc=tom@tromey.com \
    /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).