> > Ah, right. The patch oversimplifies this. We need to do sth like
> > TREE_CODE (t1) == ARRAY_TYPE && ! TYPE_NONALIASED_COMPONENT (t1) && ...
> > right?
>
> Right. Any objection to me applying this?
Not form my side - lto-symtab change makes sense to me.
With LTO all array types have canonical type so indeed we can drop the check
for structural equality used by alias.c
Honza
>
>
> lto/
> PR lto/83954
> * lto-symtab.c (warn_type_compatibility_p): Do not recurse into the
> component type of array types with non-aliased component.
> ada/
> * gcc-interface/decl.c (array_type_has_nonaliased_component): Return
> false if the component type is a pointer.
>
> --
> Eric Botcazou
> Index: ada/gcc-interface/decl.c
> ===================================================================
> --- ada/gcc-interface/decl.c (revision 257325)
> +++ ada/gcc-interface/decl.c (working copy)
> @@ -6113,6 +6113,11 @@ array_type_has_nonaliased_component (tre
> return TYPE_NONALIASED_COMPONENT (gnu_parent_type);
> }
>
> + /* Consider that an array of pointers has an aliased component, which is
> sort
> + of logical and helps with arrays of Taft Amendment types in LTO mode.
> */
> + if (POINTER_TYPE_P (TREE_TYPE (gnu_type)))
> + return false;
> +
> /* Otherwise, rely exclusively on properties of the element type. */
> return type_for_nonaliased_component_p (TREE_TYPE (gnu_type));
> }
> Index: lto/lto-symtab.c
> ===================================================================
> --- lto/lto-symtab.c (revision 257325)
> +++ lto/lto-symtab.c (working copy)
> @@ -288,9 +288,12 @@ warn_type_compatibility_p (tree prevaili
> {
> tree t1 = type, t2 = prevailing_type;
>
> - /* Alias sets of arrays are the same as alias sets of the inner
> - types. */
> - while (TREE_CODE (t1) == ARRAY_TYPE && TREE_CODE (t2) == ARRAY_TYPE)
> + /* Alias sets of arrays with aliased components are the same as alias
> + sets of the inner types. */
> + while (TREE_CODE (t1) == ARRAY_TYPE
> + && !TYPE_NONALIASED_COMPONENT (t1)
> + && TREE_CODE (t2) == ARRAY_TYPE
> + && !TYPE_NONALIASED_COMPONENT (t2))
> {
> t1 = TREE_TYPE (t1);
> t2 = TREE_TYPE (t2);