public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94905] New: Bogus warning -Werror=maybe-uninitialized
@ 2020-05-01 16:25 bug-apl at gnu dot org
  2020-05-01 22:41 ` [Bug c++/94905] " glisse at gcc dot gnu.org
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: bug-apl at gnu dot org @ 2020-05-01 16:25 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94905
           Summary: Bogus warning -Werror=maybe-uninitialized
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bug-apl at gnu dot org
  Target Milestone: ---

Hi,

as of g++ 9.3.0 when building GNU APL, g++ emits bogus warnings of type
-Werror=maybe-uninitialized.

Apparently the compiler issues these warnings simply because it is lacking
enough context to really figure out what is happening (e.g. if the supposedly
missing initialization is happening in a different function).

An example is:

https://svn.savannah.gnu.org/viewvc/apl/trunk/src/Shape.hh?view=markup

Shape.hh:133:18: error: ‘shape_Z.Shape::rho[axis]’ may be used
uninitialized in this function [-Werror=maybe-uninitialized]
         if (rho[r])   { volume /= rho[r];  rho[r] = sh;  volume *=
rho[r]; }
             ~~~~~^

The line 133 is preceded by an assertion that verifies that rho[r] is
initialized. Apparently the compiler assumes that the initialization
of rho[r] on the right of = happens after the test of rho[r] on the left
of =. It completely ignores, however, the fact that rho[r] was simply
updated and was initialized already before the function (set_shape_item)
was called.

May I kindly request to move this kind of warnings away from -Wall to
-Wextra ?

According to "man g++":

      -Wall
           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

In the example above there is no "easy to avoid" way to fix the warning.

Kind regards,
Jürgen Sauermann
Maintainer of GNU APL

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2023-07-07 10:37 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-01 16:25 [Bug c++/94905] New: Bogus warning -Werror=maybe-uninitialized bug-apl at gnu dot org
2020-05-01 22:41 ` [Bug c++/94905] " glisse at gcc dot gnu.org
2020-05-03 13:28 ` bug-apl at gnu dot org
2020-05-03 15:02 ` asolokha at gmx dot com
2020-05-03 16:10 ` bug-apl at gnu dot org
2020-05-03 16:16 ` bug-apl at gnu dot org
2020-05-03 16:26 ` asolokha at gmx dot com
2020-07-02 15:47 ` moller at mollerware dot com
2020-07-02 15:51 ` moller at mollerware dot com
2020-09-03 18:34 ` manu at gcc dot gnu.org
2020-09-03 18:46 ` [Bug c++/94905] [10 Regression] " manu at gcc dot gnu.org
2021-04-08 16:34 ` [Bug tree-optimization/94905] [10/11 " jason at gcc dot gnu.org
2022-01-21 13:41 ` rguenth at gcc dot gnu.org
2022-01-21 13:41 ` rguenth at gcc dot gnu.org
2022-01-21 13:43 ` rguenth at gcc dot gnu.org
2022-01-31 14:50 ` marxin at gcc dot gnu.org
2022-04-07  9:39 ` rguenth at gcc dot gnu.org
2022-04-07 10:01 ` jakub at gcc dot gnu.org
2022-06-28 10:40 ` jakub at gcc dot gnu.org
2023-07-07 10:37 ` [Bug tree-optimization/94905] [11 " rguenth at gcc dot gnu.org

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).