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 tree-optimization/78394] False positives of maybe-uninitialized with -Og Date: Thu, 01 Apr 2021 20:42:41 +0000 [thread overview] Message-ID: <bug-78394-4-7lm0tfPlMd@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-78394-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78394 Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed|2017-07-20 00:00:00 |2021-4-1 Known to fail| |10.2.0, 11.0, 6.3.0, 7.0.1, | |8.3.0, 9.3.0 CC| |msebor at gcc dot gnu.org --- Comment #16 from Martin Sebor <msebor at gcc dot gnu.org> --- Reconfirming with GCC 11. Both instances of the warning go back as far as support for -Og so it's not a regression. With my patched GCC the output for just the first function is: pr78394.C: In function ‘float foo()’: pr78394.C:19:17: warning: ‘vy’ may be used uninitialized in this function [-Wmaybe-uninitialized] 19 | return vx + vy; | ^~ pr78394.C:13:15: note: used when ‘(a <= i)’ 13 | float vx, vy; | ^~ pr78394.C:13:15: note: ‘vy’ was declared here pr78394.C:19:17: warning: ‘vx’ may be used uninitialized in this function [-Wmaybe-uninitialized] 19 | return vx + vy; | ^~ pr78394.C:13:11: note: used when ‘(a <= i)’ 13 | float vx, vy; | ^~ pr78394.C:13:11: note: ‘vx’ was declared here The dump the warning sees is below as as noted the root cause is that the IL satisfies the conditions under which it's designed to trigger. So the only ways to avoid it would seem to be to either a) extend the warning to figure out that the condition it uses cannot happen (basically implement some of the optimizations disabled at -Og) or b) turn off -Wmaybe-uninitialized at -Og (i.e,. remove it from -Wall). I'm not in favor of (a) but (b) makes sense to me. I'd like to try to improve it for GCC 12 so unless I fail at that I'm not for disabling it at other optimization levels. float foo () { int i; float vy; float vx; int a; float _6; float _8; <bb 2> [local count: 118111600]: # VUSE <.MEM_4(D)> a_5 = b; if (a_5 <= 3) goto <bb 3>; [50.00%] else goto <bb 8>; [50.00%] <bb 8> [local count: 59055800]: goto <bb 4>; [100.00%] <bb 3> [local count: 59055800]: <bb 4> [local count: 118111600]: # a_1 = PHI <a_5(8), 4(3)> goto <bb 6>; [100.00%] <bb 5> [local count: 955630225]: _8 = (float) i_2; i_7 = i_2 + 1; <bb 6> [local count: 1073741824]: # i_2 = PHI <1(4), i_7(5)> # .MEM_3 = PHI <.MEM_4(D)(4), .MEM_3(5)> # vx_9 = PHI <vx_11(D)(4), _8(5)> # vy_10 = PHI <vy_12(D)(4), _8(5)> if (a_1 > i_2) goto <bb 5>; [89.00%] else goto <bb 7>; [11.00%] <bb 7> [local count: 118111600]: _6 = vx_9 + vy_10; # VUSE <.MEM_3> return _6; }
next parent reply other threads:[~2021-04-01 20:42 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-78394-4@http.gcc.gnu.org/bugzilla/> 2021-04-01 20:42 ` msebor at gcc dot gnu.org [this message] 2021-04-02 8:02 ` linux at carewolf dot com 2021-06-01 9:21 ` marxin at gcc dot gnu.org 2022-08-31 11:04 ` rguenth 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-78394-4-7lm0tfPlMd@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).