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/102951] New: failure to optimize MIN_EXPR of subobject addresses of the same object Date: Tue, 26 Oct 2021 15:24:15 +0000 [thread overview] Message-ID: <bug-102951-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102951 Bug ID: 102951 Summary: failure to optimize MIN_EXPR of subobject addresses of the same object Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- GCC fails to fold the MIN_EXPR below to the lower address. The test case affects C because the C front end emits a MIN_EXPR but not C++ because the C++ front end emits an if statement. $ cat z.c && gcc -O2 -S -Wall -fdump-tree-optimized=/dev/stdout z.c extern int a[]; void f (void) { int *p1 = &a[1]; int *p2 = &a[2]; int *d = p1 < p2 ? p1 : p2; *d = 0; } ;; Function f (f, funcdef_no=0, decl_uid=1979, cgraph_uid=1, symbol_order=0) void f () { int * d; <bb 2> [local count: 1073741824]: d_1 = MIN_EXPR <&a[2], &a[1]>; // the two statements can be folded into *d_1 = 0; // MEM[(int *)&a + 4B] = 0 return; }
next reply other threads:[~2021-10-26 15:24 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-10-26 15:24 msebor at gcc dot gnu.org [this message] 2021-10-26 16:49 ` [Bug tree-optimization/102951] " jakub at gcc dot gnu.org 2021-10-27 2:43 ` pinskia at gcc dot gnu.org 2021-10-27 6:56 ` rguenth at gcc dot gnu.org 2021-10-27 10:37 ` jakub at gcc dot gnu.org 2021-10-28 18:11 ` cvs-commit 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-102951-4@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).