diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3c6a45e8fe7..2d6c5c88b7d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2020-04-15 Richard Biener + + PR middle-end/94539 + * tree-ssa-alias.c (same_type_for_tbaa): Defer to + alias_sets_conflict_p for pointers. + 2020-04-14 Max Filippov PR target/94584 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 69f9b93cd49..0e4eea3873d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-04-15 Richard Biener + + PR middle-end/94539 + * gcc.dg/alias-14.c: Make dg-do run. + 2020-04-13 Max Filippov PR target/94584 diff --git a/gcc/testsuite/gcc.dg/alias-14.c b/gcc/testsuite/gcc.dg/alias-14.c index 1ca1c09d5e3..24f0d1c1168 100644 --- a/gcc/testsuite/gcc.dg/alias-14.c +++ b/gcc/testsuite/gcc.dg/alias-14.c @@ -1,4 +1,4 @@ -/* { dg-do compile } */ +/* { dg-do run } */ /* { dg-options "-O2" } */ #include void *a; diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index df9ba0de0d6..ede4f198342 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -839,7 +839,16 @@ same_type_for_tbaa (tree type1, tree type2) would mean that conversions between them are useless, whereas they are not (e.g. type and subtypes can have different modes). So, in the end, they are only guaranteed to have the same alias set. */ - if (get_alias_set (type1) == get_alias_set (type2)) + alias_set_type set1 = get_alias_set (type1); + alias_set_type set2 = get_alias_set (type2); + if (set1 == set2) + return -1; + + /* Pointers to void are considered compatible with all other pointers, + so for two pointers see what the alias set resolution thinks. */ + if (POINTER_TYPE_P (type1) + && POINTER_TYPE_P (type2) + && alias_sets_conflict_p (set1, set2)) return -1; /* The types are known to be not equal. */