public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/114206] recursive function call vs local variable addresses Date: Mon, 04 Mar 2024 09:54:56 +0000 [thread overview] Message-ID: <bug-114206-4-GtXSkH7qmW@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-114206-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114206 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed| |2024-03-04 --- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> --- So we simplify this and RTL expand from int f (int t, const int * a) { const int b[4]; _Bool _1; int _8; <bb 2> [local count: 1073741824]: if (t_3(D) == 0) goto <bb 3>; [49.25%] else goto <bb 4>; [50.75%] <bb 3> [local count: 528857912]: <bb 4> [local count: 1073741824]: # a_11 = PHI <a_5(D)(2), &b(3)> _1 = &b == a_11; _8 = (int) _1; b ={v} {CLOBBER(eos)}; return _8; We apply tail-recursion optimization here which coalescs both slots which are used just by their address. IIRC tail-recursion analysis uses alias analysis to be able to handle some cases where TREE_ADDRESSABLE vars are passed. We miss considering variables live that are passed by reference (but otherwise are "unused"). As you needed to cut off quite some optimizations to early simplify the b == a compare this is a bit academic or needs much more obfuscation of the compare to actually matter. But yes, it's a bug.
next prev parent reply other threads:[~2024-03-04 9:54 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-03-02 9:06 [Bug c/114206] New: GCC generates wrong-code congli at smail dot nju.edu.cn 2024-03-02 9:13 ` [Bug tree-optimization/114206] " pinskia at gcc dot gnu.org 2024-03-02 9:27 ` [Bug tree-optimization/114206] recursive function call vs local variable addresses congli at smail dot nju.edu.cn 2024-03-02 9:36 ` congli at smail dot nju.edu.cn 2024-03-02 11:06 ` xry111 at gcc dot gnu.org 2024-03-02 15:15 ` arsen at gcc dot gnu.org 2024-03-04 9:54 ` rguenth at gcc dot gnu.org [this message] 2024-03-04 17:31 ` [Bug tree-optimization/114206] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org 2024-03-05 12:14 ` jakub 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-114206-4-GtXSkH7qmW@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).