Just like PR 23134, here is another testcase for the aliasing thinking that the
address escapes but this time it has SFT's involved and we should not have a
V_MAY_DEF for k.i:
static void f(char *a)
{
  *a = 1;
}

struct g
{
  char i, j;
};

void h(void)
{
  struct g k = {2, 2};
  f(&k.j);
  if (k.i != 2)
    link_error ();
}

Compile with -O2 -fno-inline to force f not to inline.


-- 
           Summary: Address (full struct) escapes even though the called
                    function does not cause it to escape
           Product: gcc
           Version: 4.1.0
            Status: NEW
          Keywords: missed-optimization, alias
          Severity: enhancement
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24169

Reply via email to