Fix ICE with typeless storage

Jan Hubicka hubicka@ucw.cz
Fri Jun 5 09:07:46 GMT 2020


Hi,
this patch fixes ICE while bulding Firefox on assert in
record_component_aliases which checks that the alias set did not change
while peeling off vector and array types.
This is done so we can translate notice references to pointers.

If array is TYPE_TYPELESS_STORAGE then it is not true that array type
woud have same alias set as its elements since its alias set is 0, so we
need to watch for this. (And it is safe to miss pointer here once we add
alias set 0 as a component)

Honza

	* alias.c (record_component_aliases): Watch for typeless storage while
	skipping the ARRAY_TREE wrappers.

diff --git a/gcc/alias.c b/gcc/alias.c
index 49bd7b37966..2bed5e78c62 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -1273,8 +1273,12 @@ record_component_aliases (tree type, alias_set_type superset)
 		{
 		  /* VECTOR_TYPE and ARRAY_TYPE share the alias set with their
 		     element type and that type has to be normalized to void *,
-		     too, in the case it is a pointer. */
-		  while (!canonical_type_used_p (t) && !POINTER_TYPE_P (t))
+		     too, in the case it is a pointer.
+		     An exception is array with TYPE_TYPELESS_STORAGE which
+		     has alias set 0.  */
+		  while (!canonical_type_used_p (t) && !POINTER_TYPE_P (t)
+			 && (!AGGREGATE_TYPE_P (t)
+			     || !TYPE_TYPELESS_STORAGE (t)))
 		    {
 		      gcc_checking_assert (TYPE_STRUCTURAL_EQUALITY_P (t));
 		      t = TREE_TYPE (t);


More information about the Gcc-patches mailing list