The following testcase emits a strict-aliasing warning because the points-to
result for p is wrong.  It should be pt_anything, but instead the read from
s.q is considered a non-pointer variable (we do not have constraints for all
implicitly taken addresses by passing &s to the function call).

struct S { int *p; int *q; };

void foo (struct S *);

int bar (int b)
{
  struct S s;
  int *p;
  float f;
  foo (&s);
  if (b)
    p = s.q;
  else
    p = (int *)&f;
  return *p;
}

Inspecting the points-to results on

struct S { int *p; int *q; };

void foo (struct S *);

int *bar (int b)
{
  struct S s;
  foo (&s);
  return s.q;
}

exposes the failure as

ESCAPED = { ESCAPED NONLOCAL s s.64+64 }
...
s = { ESCAPED NONLOCAL }
s.64+64 = { ESCAPED NONLOCAL }
D.1598_1 = { }


D.1598_1 should have the same solution as s.64+64.


-- 
           Summary: points-to result wrong for reads from call-clobbered
                    vars
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


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

Reply via email to