Alexander Monakov <amona...@ispras.ru> writes:
> diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
> index 163b7a2d03b..4f9a8802aeb 100644
> --- a/gcc/tree-sra.c
> +++ b/gcc/tree-sra.c
> @@ -1542,19 +1542,17 @@ compare_access_positions (const void *a, const void 
> *b)
>              && TREE_CODE (f2->type) != COMPLEX_TYPE
>              && TREE_CODE (f2->type) != VECTOR_TYPE)
>       return -1;
> +      /* Put any non-integral type before any integral type.  */
> +      else if (INTEGRAL_TYPE_P (f1->type)
> +            && !INTEGRAL_TYPE_P (f2->type))
> +     return 1;
> +      else if (!INTEGRAL_TYPE_P (f1->type)
> +            && INTEGRAL_TYPE_P (f2->type))
> +     return -1;
>        /* Put the integral type with the bigger precision first.  */
>        else if (INTEGRAL_TYPE_P (f1->type)
>              && INTEGRAL_TYPE_P (f2->type))
>       return TYPE_PRECISION (f2->type) - TYPE_PRECISION (f1->type);
> -      /* Put any integral type with non-full precision last.  */
> -      else if (INTEGRAL_TYPE_P (f1->type)
> -            && (TREE_INT_CST_LOW (TYPE_SIZE (f1->type))
> -                != TYPE_PRECISION (f1->type)))
> -     return 1;
> -      else if (INTEGRAL_TYPE_P (f2->type)
> -            && (TREE_INT_CST_LOW (TYPE_SIZE (f2->type))
> -                != TYPE_PRECISION (f2->type)))
> -     return -1;
>        /* Stabilize the sort.  */
>        return TYPE_UID (f1->type) - TYPE_UID (f2->type);
>      }

LGTM FWIW, but isn't there also the problem that the TYPE_PRECISION
test fails to stabilise the sort if you have two integral types with
the same precision?

Thanks,
Richard

Reply via email to