From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 63B333857804; Fri, 26 Mar 2021 22:16:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 63B333857804 From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/57832] compiling sha-256 code (xz 5.0.5) generates false warnings when using -march=native on Atom CPU Date: Fri, 26 Mar 2021 22:16:04 +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: 4.8.1 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor at gcc dot gnu.org X-Bugzilla-Status: NEW 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: cf_reconfirmed_on cf_known_to_fail cc 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: Fri, 26 Mar 2021 22:16:05 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D57832 Martin Sebor changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed|2018-10-09 00:00:00 |2021-3-26 Known to fail| |10.2.0, 11.0, 4.8.4, 4.9.4, | |5.5.0, 6.4.0, 7.2.0, 8.3.0, | |9.1.0 CC| |msebor at gcc dot gnu.org --- Comment #4 from Martin Sebor --- Reconfirmed with GCC 11 and a slightly further reduced test case: int a, b, d; void f (void) { unsigned c; for (int e =3D 0; e < 64; e +=3D 6) { if (e) b =3D e; else c =3D d; if (e) a +=3D c; } } The output with a slightly patched GCC to add notes after the warning shows= the condition under which the variable is used uninitialized: pr57832.c: In function =E2=80=98f=E2=80=99: pr57832.c:15:11: warning: =E2=80=98c=E2=80=99 may be used uninitialized in = this function [-Wmaybe-uninitialized] 15 | a +=3D c; | ^~ pr57832.c:5:12: note: used when =E2=80=98ivtmp !=3D 0=E2=80=99 5 | unsigned c; | ^ pr57832.c:5:12: note: =E2=80=98c=E2=80=99 was declared here The annotated dump below helps explain what's going on: the c_21 PHI in bb = 3 is (partly) uninitialized. The warning finds its first use (1) in c_21 in bb = 3.=20 It then finds its use (2) in c_25 in bb 5. Finally, it finds c_25's use (3= ) in the assignment to _4 in bb 4. In other words, the uninitialized c flows fr= om -> -> -> -> ->= . I don't see anything in the IL to avoid coming to this conclusion = so I don't think there's anything to change in the warning code to suppress it. ;; Function f (f, funcdef_no=3D0, decl_uid=3D1946, cgraph_uid=3D1, symbol_o= rder=3D3) [WORKLIST]: add to initial list: c_21 =3D PHI [CHECK]: examining phi: c_21 =3D PHI [CHECK] Found def edge 1 in c_25 =3D PHI [CHECK]: Found unguarded use: c_25 =3D PHI [WORKLIST]: Update worklist with phi: c_25 =3D PHI [CHECK] Found def edge 1 in c_25 =3D PHI [CHECK]: Found unguarded use: _4 =3D a.2_3 + c_21; { unsigned int ivtmp.11; unsigned int ivtmp.10; int a_lsm.7; int b_lsm.6; int e; unsigned int c; int d.0_1; unsigned int a.2_3; unsigned int _4; int _5; [local count: 89442694]: d.0_1 =3D d; c_14 =3D (unsigned int) d.0_1; a_lsm.7_18 =3D a; [local count: 984299128]: # c_21 =3D PHI <<< use 1: c_12(D)= is uninitialized # a_lsm.7_11 =3D PHI # ivtmp.10_2 =3D PHI # ivtmp.11_20 =3D PHI e_22 =3D (int) ivtmp.10_2; if (e_22 !=3D 0) goto ; [64.00%] else goto ; [36.00%] [local count: 354347685]: goto ; [100.00%] [local count: 629951444]: a.2_3 =3D (unsigned int) a_lsm.7_11; _4 =3D a.2_3 + c_21; <<< use 3: -Wmaybe-uninitialized _5 =3D (int) _4; e_17 =3D (int) ivtmp.11_20; if (e_17 <=3D 63) goto ; [86.98%] else goto ; [13.02%] [local count: 547959327]: <<< c_21(8) =3D c21(= 3) [local count: 902307011]: # c_25 =3D PHI <<< use 2: c_25 =3D c_21(8) # a_lsm.7_10 =3D PHI <_5(8), a_lsm.7_11(7)> ivtmp.10_7 =3D ivtmp.10_2 + 6; ivtmp.11_26 =3D ivtmp.11_20 + 6; goto ; [100.00%] [local count: 89442696]: b =3D e_22; a =3D _5; return; }=