public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "msebor at gcc dot gnu.org" <gcc-bugzilla@gcc.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 [thread overview] Message-ID: <bug-57832-4-rfbnLHTX6l@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-57832-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57832 Martin Sebor <msebor at gcc dot gnu.org> 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 <msebor at gcc dot gnu.org> --- Reconfirmed with GCC 11 and a slightly further reduced test case: int a, b, d; void f (void) { unsigned c; for (int e = 0; e < 64; e += 6) { if (e) b = e; else c = d; if (e) a += 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 ‘f’: pr57832.c:15:11: warning: ‘c’ may be used uninitialized in this function [-Wmaybe-uninitialized] 15 | a += c; | ^~ pr57832.c:5:12: note: used when ‘ivtmp != 0’ 5 | unsigned c; | ^ pr57832.c:5:12: note: ‘c’ 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. 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 from <bb 2: c_12(D)> -> <bb 3: c_21> -> <bb 8> -> <bb 5: c25> -> <bb 3: c_21> -> <bb 4: _4>. 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=0, decl_uid=1946, cgraph_uid=1, symbol_order=3) [WORKLIST]: add to initial list: c_21 = PHI <c_25(5), c_12(D)(2)> [CHECK]: examining phi: c_21 = PHI <c_25(5), c_12(D)(2)> [CHECK] Found def edge 1 in c_25 = PHI <c_21(8), c_14(7)> [CHECK]: Found unguarded use: c_25 = PHI <c_21(8), c_14(7)> [WORKLIST]: Update worklist with phi: c_25 = PHI <c_21(8), c_14(7)> [CHECK] Found def edge 1 in c_25 = PHI <c_21(8), c_14(7)> [CHECK]: Found unguarded use: _4 = 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; <bb 2> [local count: 89442694]: d.0_1 = d; c_14 = (unsigned int) d.0_1; a_lsm.7_18 = a; <bb 3> [local count: 984299128]: # c_21 = PHI <c_25(5), c_12(D)(2)> <<< use 1: c_12(D) is uninitialized # a_lsm.7_11 = PHI <a_lsm.7_10(5), a_lsm.7_18(2)> # ivtmp.10_2 = PHI <ivtmp.10_7(5), 0(2)> # ivtmp.11_20 = PHI <ivtmp.11_26(5), 6(2)> e_22 = (int) ivtmp.10_2; if (e_22 != 0) goto <bb 4>; [64.00%] else goto <bb 7>; [36.00%] <bb 7> [local count: 354347685]: goto <bb 5>; [100.00%] <bb 4> [local count: 629951444]: a.2_3 = (unsigned int) a_lsm.7_11; _4 = a.2_3 + c_21; <<< use 3: -Wmaybe-uninitialized _5 = (int) _4; e_17 = (int) ivtmp.11_20; if (e_17 <= 63) goto <bb 8>; [86.98%] else goto <bb 6>; [13.02%] <bb 8> [local count: 547959327]: <<< c_21(8) = c21(3) <bb 5> [local count: 902307011]: # c_25 = PHI <c_21(8), c_14(7)> <<< use 2: c_25 = c_21(8) # a_lsm.7_10 = PHI <_5(8), a_lsm.7_11(7)> ivtmp.10_7 = ivtmp.10_2 + 6; ivtmp.11_26 = ivtmp.11_20 + 6; goto <bb 3>; [100.00%] <bb 6> [local count: 89442696]: b = e_22; a = _5; return; }
next prev parent reply other threads:[~2021-03-26 22:16 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-07-05 18:59 [Bug c/57832] New: " olivier.pis.langlois at transport dot alstom.com 2021-03-26 22:16 ` msebor at gcc dot gnu.org [this message] 2021-03-27 9:02 ` [Bug middle-end/57832] " manu at gcc dot gnu.org 2021-03-27 21:32 ` msebor at gcc dot gnu.org 2021-03-28 11:17 ` manu at gcc dot gnu.org 2022-11-20 3:50 ` law at gcc dot gnu.org 2022-11-20 4:13 ` pinskia at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-57832-4-rfbnLHTX6l@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).