diff mbox series

Fix ICE with typeless storage

Message ID 20200605090746.GB22225@kam.mff.cuni.cz
State New
Headers show
Series Fix ICE with typeless storage | expand

Commit Message

Jan Hubicka June 5, 2020, 9:07 a.m. UTC
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.

Comments

Richard Biener June 9, 2020, 8:22 a.m. UTC | #1
On Fri, Jun 5, 2020 at 11:08 AM Jan Hubicka <hubicka@ucw.cz> wrote:
>
> 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)

OK.

> 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);
diff mbox series

Patch

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);