From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D261A3938C26; Fri, 1 May 2020 16:25:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D261A3938C26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1588350302; bh=qZeNqb4QN+Jv/uFVZsrmLzDE+BPBUw4ei+2zYisn0Cw=; h=From:To:Subject:Date:From; b=ponmELZnSWHzkpbGHQj3NMIp71LsTcpgWYjVIDHgXbAd9LJyxHYOoYs57R6OCTlzP D/TofxNnaEqrWuGW8EqXoF00pLbX7sVhNe0t0dPkdXvSH6d0Fux7KDhuYxY12RdO5k wpoqbnsxvZM7qaH26JZ4aiXFnr63GkKmiDqMkVO0= From: "bug-apl at gnu dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/94905] New: Bogus warning -Werror=maybe-uninitialized Date: Fri, 01 May 2020 16:25:02 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 9.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: bug-apl at gnu dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 16:25:02 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94905 Bug ID: 94905 Summary: Bogus warning -Werror=3Dmaybe-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=3Dmaybe-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 supposed= ly missing initialization is happening in a different function). An example is: https://svn.savannah.gnu.org/viewvc/apl/trunk/src/Shape.hh?view=3Dmarkup Shape.hh:133:18: error: =E2=80=98shape_Z.Shape::rho[axis]=E2=80=99 may be u= sed uninitialized in this function [-Werror=3Dmaybe-uninitialized] if (rho[r]) { volume /=3D rho[r]; rho[r] =3D sh; volume *=3D 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 =3D happens after the test of rho[r] on the left of =3D. 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=C3=BCrgen Sauermann Maintainer of GNU APL=