------- Comment #5 from rguenth at gcc dot gnu dot org 2009-02-04 20:59 -------
On the alias-improvements branch the testcase also fails with
-O -fdelete-null-pointer-checks, so this is definitely a PTA bug.
PTA thinks the points-to set for na_5 is
na_5, is dereferenced, points-to NULL, points-to vars: { nl }
which would definitely enable deleting the store, as nl is a local variable.
The constraints that should make na_5 point to NONLOCAL as well are
h = &NONLOCAL
x = &NONLOCAL
x_1 = x
*na_5 = x_1
D.1262_20 = *na_5
na_21 = D.1262_20 + 32
na_4 = na_21
na_5 = na_4
relevant unifications are
Unifying x to h
Unifying na_4 to na_5
The PTA bug can be seen with the following simplified testcase:
typedef struct E
{
struct E *n;
} *EP;
void __attribute__((noinline))
foo (EP x)
{
EP nl = 0, *na = &nl;
EP n;
while (x)
{
n = x->n;
*na = x;
na = &((*na)->n);
x = n;
}
*na = 0;
}
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dberlin at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39100