From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id ABF293886C5F; Thu, 15 Apr 2021 16:49:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ABF293886C5F From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/81962] -Wmaybe-uninitialized refers to wrong line (and only works with -O3) (Fortran) Date: Thu, 15 Apr 2021 16:49:51 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 7.1.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: DUPLICATE 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: see_also cc bug_status resolution Message-ID: In-Reply-To: References: 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: Thu, 15 Apr 2021 16:49:51 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D81962 Martin Sebor changed: What |Removed |Added ---------------------------------------------------------------------------- See Also|https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=3D63943 | CC| |msebor at gcc dot gnu.org Status|NEW |RESOLVED Resolution|--- |DUPLICATE --- Comment #5 from Martin Sebor --- This is, in fact, a duplicate of pr63943. A C test case that reproduces the same effect is below. I doubt this will = ever be perfect. $ cat a.c && gcc -O2 -S -Wall -fdump-tree-uninit-lineno=3D/dev/stdout a.c int z; void f (int i) { z =3D i + 1; } void g (int a, int b, int c) { int x; if (a && b) x =3D a + b; if (b && c)=20 f (x + 1); } ;; Function f (f, funcdef_no=3D0, decl_uid=3D1944, cgraph_uid=3D1, symbol_o= rder=3D1) void f (int i) { int _1; [local count: 1073741824]: [a.c:5:9] _1 =3D i_2(D) + 1; [a.c:5:5] z =3D _1; [a.c:6:1] return; } ;; Function g (g, funcdef_no=3D1, decl_uid=3D1949, cgraph_uid=3D2, symbol_o= rder=3D2) ... a.c: In function =E2=80=98g=E2=80=99: a.c:5:9: warning: =E2=80=98x=E2=80=99 may be used uninitialized in this fun= ction [-Wmaybe-uninitialized] 5 | z =3D i + 1; | ~~^~~ a.c:10:7: note: =E2=80=98x=E2=80=99 was declared here 10 | int x; | ^ void g (int a, int b, int c) { int x; _Bool _1; _Bool _2; _Bool _3; _Bool _4; _Bool _5; int _14; [local count: 1073741824]: [a.c:11:7] _1 =3D a_8(D) !=3D 0; [a.c:11:9] _2 =3D b_9(D) !=3D 0; [a.c:11:9] _3 =3D _1 & _2; [a.c:11:6] if (_3 !=3D 0) goto ; [50.00%] else goto ; [50.00%] [local count: 536870912]: goto ; [100.00%] [local count: 536870913]: [a.c:12:7] x_11 =3D a_8(D) + b_9(D); [local count: 1073741824]: # x_6 =3D PHI [a.c:14:9] _4 =3D c_12(D) !=3D 0; [a.c:14:9] _5 =3D _2 & _4; [a.c:14:6] if (_5 !=3D 0) goto ; [50.00%] else goto ; [50.00%] [local count: 536870912]: goto ; [100.00%] [local count: 536870913]: [a.c:5:9] _14 =3D x_6 + 2; [a.c:5:5] z =3D _14; [local count: 1073741824]: [a.c:16:1] return; } *** This bug has been marked as a duplicate of bug 63943 ***=