Bug 38048

Summary: [4.3 Regression] Wrong alias info for array access
Product: gcc Reporter: Richard Biener <rguenth>
Component: tree-optimizationAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED DUPLICATE    
Severity: normal CC: fang, gcc-bugs, rguenth, sabre
Priority: P3 Keywords: alias, wrong-code
Version: 4.3.2   
Target Milestone: 4.3.3   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:

Description Richard Biener 2008-11-07 12:37:52 UTC
extern void abort(void);

int foo ()
{
  int mat[2][1];
  int (*a)[1] = mat;
  int det = 0;
  int i;
  mat[0][0] = 1;
  mat[1][0] = 2;
  for (i = 0; i < 2; ++i)
    det += a[i][0];
  return det;
}

int main()
{
  if (foo () != 3)
    abort ();
  return 0;
}
Comment 1 Richard Biener 2008-11-07 12:50:00 UTC
Actually this is a dup of PR37868.  The points-to results for the access are
wrong:

  D.1577_7 = &mat + D.1576_6;
  # VUSE <SFT.18_14>
  D.1578_8 = (*D.1577_7)[0];

from the constraints

D.1577_7 = &mat
D.1577_7 = D.1576_6

(which are wrong)

we compute

D.1577_7 = { mat }

but correct would be { mat mat.32 }

with the fix for PR37868 we immediately say

D.1577_7 = { ANYTHING }

and this becomes a pessimization for field-sensitive points-to analysis.  See
PR38049 for this.

*** This bug has been marked as a duplicate of 37868 ***