aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-alias.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2020-04-14 13:16:25 +0200
committerRichard Biener <rguenther@suse.de>2020-04-15 09:19:26 +0200
commite71b408aa242ffc76ffd19ebcdbd40279a1d9349 (patch)
tree19da1ef7ccdb744483811f95be28b003256bd893 /gcc/tree-ssa-alias.c
parent5b6551bc6049b34425fb96e8d91eb15b04f87f62 (diff)
downloadgcc-e71b408aa242ffc76ffd19ebcdbd40279a1d9349.zip
gcc-e71b408aa242ffc76ffd19ebcdbd40279a1d9349.tar.gz
gcc-e71b408aa242ffc76ffd19ebcdbd40279a1d9349.tar.bz2
middle-end/94539 - void * aliases every other pointer
This makes same_type_for_tbaa_p conservative in the same way get_alias_set is about void * which we allow to alias all other pointers. 2020-04-15 Richard Biener <rguenther@suse.de> PR middle-end/94539 * tree-ssa-alias.c (same_type_for_tbaa): Defer to alias_sets_conflict_p for pointers. * gcc.dg/alias-14.c: Make dg-do run.
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r--gcc/tree-ssa-alias.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index df9ba0d..ede4f19 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. */