Bug 38048 - [4.3 Regression] Wrong alias info for array access
[4.3 Regression] Wrong alias info for array access
Status: RESOLVED DUPLICATE of bug 37868
Product: gcc
Classification: Unclassified
Component: tree-optimization
4.3.2
: P3 normal
: 4.3.3
Assigned To: Not yet assigned to anyone
: alias, wrong-code
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-11-07 12:37 UTC by Richard Biener
Modified: 2008-11-07 12:50 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ***