public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/105337] [12 Regression] wrong code at -Os and above on x86_64-linux-gnu Date: Thu, 21 Apr 2022 16:58:52 +0000 [thread overview] Message-ID: <bug-105337-4-PPccJKtvLq@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-105337-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105337 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu.org --- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I'd say that ivopts is at fault here. Before that we have: <bb 2> [local count: 312727306]: <bb 3> [local count: 805306369]: # b_14 = PHI <b_9(6), 0(2)> # c_15 = PHI <c_7(6), c_5(D)(2)> # ivtmp_3 = PHI <ivtmp_2(6), 3(2)> a.0_1 = a; if (a.0_1 == 0) goto <bb 7>; [5.50%] else goto <bb 4>; [94.50%] ... <bb 7> [local count: 44291850]: # b_4 = PHI <b_14(3)> <bb 5> [local count: 312727306]: # b_10 = PHI <b_4(7), 3(8)> return b_10; as the path actually taken at runtime, yes, we use uninitialized c in the PHI, but that doesn't correspond to UB at runtime. But ivopts changes that to: <bb 2> [local count: 312727306]: _19 = (unsigned int) c_5(D); _20 = _19 + 4294967293; _21 = (int) _20; <bb 3> [local count: 805306369]: # c_15 = PHI <c_7(6), c_5(D)(2)> _13 = (unsigned int) c_5(D); _12 = (unsigned int) c_15; _11 = -_12; _18 = _11 + _13; b_14 = (int) _18; a.0_1 = a; if (a.0_1 == 0) goto <bb 7>; [5.50%] else goto <bb 4>; [94.50%] ... <bb 7> [local count: 44291850]: # b_4 = PHI <b_14(3)> <bb 5> [local count: 312727306]: # b_10 = PHI <b_4(7), 3(8)> return b_10; and now it uses the uninitialized value in arithmetics in the actually executed code. And, even the return value which gets a copy of b_14 now depends on that uninitialized value. I think we had some other PR about this... Then comes ccp4 and figures out that many values are UNDEFINED and optimizes it into return 3;
next prev parent reply other threads:[~2022-04-21 16:58 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-04-21 16:16 [Bug tree-optimization/105337] New: " zhendong.su at inf dot ethz.ch 2022-04-21 16:16 ` [Bug tree-optimization/105337] " zhendong.su at inf dot ethz.ch 2022-04-21 16:32 ` [Bug tree-optimization/105337] [12 Regression] " mpolacek at gcc dot gnu.org 2022-04-21 16:41 ` mpolacek at gcc dot gnu.org 2022-04-21 16:43 ` mpolacek at gcc dot gnu.org 2022-04-21 16:49 ` jakub at gcc dot gnu.org 2022-04-21 16:58 ` jakub at gcc dot gnu.org [this message] 2022-04-21 17:00 ` jakub at gcc dot gnu.org 2022-04-22 6:11 ` 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-105337-4-PPccJKtvLq@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).