This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix gnat.dg/lto20.adb XPASS
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, Rainer Orth <ro at cebitec dot uni-bielefeld dot de>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 2 Feb 2018 12:41:42 +0100
- Subject: Re: Fix gnat.dg/lto20.adb XPASS
- Authentication-results: sourceware.org; auth=none
- References: <yddwozznlma.fsf@CeBiTec.Uni-Bielefeld.DE> <3231475.XPI09i3PTr@polaris> <CAFiYyc2dOu66fO7eeNF0xkSDGPpN8-fEb1=vgG82QDCWUbSfrA@mail.gmail.com> <8162152.1BGh9HDpL1@polaris>
> > 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);