GCC 12.1 Release Candidate available from gcc.gnu.org

Marc Glisse marc.glisse@inria.fr
Mon May 2 12:26:18 GMT 2022


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


More information about the Gcc mailing list