public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Martin Sebor via Gcc-help <gcc-help@gcc.gnu.org>,
	Dumitru Ceara <dceara@redhat.com>,
	Martin Sebor <msebor@gmail.com>,
	richard.sandiford@arm.com
Subject: Re: Potentially false-positive -Wstringop-overflow= warning with gcc >= 11.1
Date: Tue, 1 Feb 2022 08:42:39 -0600	[thread overview]
Message-ID: <20220201144239.GT614@gate.crashing.org> (raw)
In-Reply-To: <mpto83rgo5a.fsf@arm.com>

On Tue, Feb 01, 2022 at 05:18:57AM +0000, Richard Sandiford wrote:
> I agree that changing the wording doesn't solve the whole problem,
> but I think it does solve something.  At the moment, we're effectively
> asking each individual user to be aware of the context above, to know what
> meaning is being attached to the present tense.  Making the message more
> equivocal would at least suggest that the compiler doesn't “know”.

The compiler *does* know (in this case), but only for one internal copy
of the code.  The warning message (which could be an error in this case,
the code replaced with a trap: a dest or source that does not point at
an object is undefined behaviour, for memcpy).

But the error message suggests that this happens on *every* execution of
the memcpy.  Which is wrong, misleading, the cause of all the confusion
here.

> It's not the pass's “fault” that it can't tell how closely the IL
> it sees matches the original code.  But it is GCC's “fault” as a whole,
> not the user's, and I think that's what matters here.

Yeah.

> > What I think is needed here is to mention the conditions
> > under which the invalid statement is executed.  With that, we should
> > be able to print the same context as what the static analyzer prints:

> I agree this would be better, but I don't think it should hold back
> tweaks to the error messages in the meantime.  (And if the tracing
> was an optional feature, we'd still want wording that makes sense
> when the feature is turned off.)

Exactly.  It shouldn't be all that hard to steer the user towards
discovering what is wrong with his code, instead of causing the user to
think GCC is wrong again.

> I realise this is rehashing an old discussion, sorry.  But it seems
> like it's a discussion that gets rehashed precisely because it's
> about an issue that users keep hitting.

Agreed, this needs to be fixed.  The bigger issue is communication, the
way diagnostic messages are phrased, not the analysis itself :-)


Segher

  reply	other threads:[~2022-02-01 14:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28 15:01 Dumitru Ceara
2022-01-28 15:27 ` Segher Boessenkool
2022-01-28 16:16   ` Dumitru Ceara
2022-01-28 17:37     ` Segher Boessenkool
2022-01-31 21:49     ` Martin Sebor
2022-01-31 22:01       ` Segher Boessenkool
2022-02-01  8:21         ` Jonathan Wakely
2022-02-01  5:18       ` Richard Sandiford
2022-02-01 14:42         ` Segher Boessenkool [this message]
2022-02-01 23:54         ` Martin Sebor
2022-02-02 10:12           ` Jonathan Wakely
2022-02-02 18:33             ` Segher Boessenkool
2022-02-02 20:44               ` Jonathan Wakely
2022-02-02 18:23           ` Segher Boessenkool

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=20220201144239.GT614@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=dceara@redhat.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=msebor@gmail.com \
    --cc=richard.sandiford@arm.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).