public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/102951] New: failure to optimize MIN_EXPR of subobject addresses of the same object
@ 2021-10-26 15:24 msebor at gcc dot gnu.org
  2021-10-26 16:49 ` [Bug tree-optimization/102951] " jakub at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-10-26 15:24 UTC (permalink / raw)
  To: gcc-bugs

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;

}

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-10-28 18:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26 15:24 [Bug tree-optimization/102951] New: failure to optimize MIN_EXPR of subobject addresses of the same object msebor at gcc dot gnu.org
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

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).