public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Marc Glisse <marc.glisse@inria.fr>
To: Boris Kolpackov <boris@codesynthesis.com>
Cc: gcc@gcc.gnu.org
Subject: Re: GCC 12.1 Release Candidate available from gcc.gnu.org
Date: Mon, 2 May 2022 14:26:18 +0200 (CEST)	[thread overview]
Message-ID: <6b76a0f7-df1d-934-b77c-6b89f11a6594@hippo.saclay.inria.fr> (raw)
In-Reply-To: <boris.20220502133929@codesynthesis.com>

On Mon, 2 May 2022, Boris Kolpackov wrote:

> Jakub Jelinek <jakub@redhat.com> writes:
>
>> The first release candidate for GCC 12.1 is available [...]
>
> There is an unfixed bogus warning that is a regression in 12
> and that I think will have a pretty wide effect (any code
> that assigns/appends a 1-char string literal to std::string):
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105329
>
> For example, in my relatively small codebase I had about 20
> instances of this warning. Seeing that it's enabled as part
> of -Wall (not just -Wextra), I believe there will be a lot
> of grumpy users.
>
> There is a proposed work around in this (duplicate) bug that
> looks pretty simple:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104336
>
> Perhaps it makes sense to consider it?

Please no, that workaround looks like a fragile hack (basically writing 
a+b-a to obfuscate b) that may break if you look at it sideways and likely 
makes the generated code a bit worse. Besides, we should take it as a hint 
that user code is also likely to trigger the warning by accident.

IMO there are several ways to make progress on this in parallel:

* improve the optimizer (as investigated by Andrew)

* tweak the warning so it becomes either cleverer or less eager (maybe 
even use the fact that this special case is in a system header? that 
should be a last resort though)

* battle that has already been lost, no need to rehash it:

--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -1450,3 +1450,3 @@ Warn when a declaration has duplicate const, 
volatile, restrict or _Atomic speci
  Wrestrict
-C ObjC C++ ObjC++ Var(warn_restrict) Warning LangEnabledBy(C ObjC C++ ObjC++, Wall)
+C ObjC C++ ObjC++ Var(warn_restrict) Warning LangEnabledBy(C ObjC C++ ObjC++, Wextra)
  Warn when an argument passed to a restrict-qualified parameter aliases with

Or admit that

--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -5729,4 +5729,3 @@ by this option and not enabled by the latter and vice versa.
  This enables all the warnings about constructions that some users
-consider questionable, and that are easy to avoid (or modify to
-prevent the warning), even in conjunction with macros.  This also
+consider questionable.  This also
  enables some language-specific warnings described in @ref{C++ Dialect

-- 
Marc Glisse

  reply	other threads:[~2022-05-02 12:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-29 14:34 Jakub Jelinek
2022-05-01 10:02 ` Iain Sandoe
2022-05-01 11:41   ` Jakub Jelinek
2022-05-01 15:38     ` Richard Biener
2022-05-01 18:06       ` Jonathan Wakely
2022-05-02 11:49 ` Boris Kolpackov
2022-05-02 12:26   ` Marc Glisse [this message]
2022-05-02 15:42     ` Jonathan Wakely

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=6b76a0f7-df1d-934-b77c-6b89f11a6594@hippo.saclay.inria.fr \
    --to=marc.glisse@inria.fr \
    --cc=boris@codesynthesis.com \
    --cc=gcc@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).