Hi,

FYI. This patch works for my application LTO build on aarch64.

Thanks,
-Jiangning

> -----Original Message-----
> From: gcc-patches-ow...@gcc.gnu.org <gcc-patches-ow...@gcc.gnu.org>
> On Behalf Of Jan Hubicka
> Sent: Monday, July 1, 2019 8:22 PM
> To: Christophe Lyon <christophe.l...@linaro.org>
> Cc: Eric Botcazou <ebotca...@adacore.com>; gcc Patches <gcc-
> patc...@gcc.gnu.org>; Richard Biener <rguent...@suse.de>; d...@dcepelik.cz;
> Martin Liška <mli...@suse.cz>
> Subject: Re: Use ODR for canonical types construction in LTO
> 
> Hi,
> this patch fixes the ICE. Problem is that va_arg type is pre-streamed and thus
> at stream-in time we have main variant constructed by LTO FE which
> is !CXX_ODR_P while vairants are ones comming from C++ FE which are ODR.
> It is safe to drop the flags here since we only care about main variants
> anyway.
> 
> I am testing the patch on aarch64 now.
> 
> Honza
> 
> Index: lto/lto-common.c
> ================================================================
> ===
> --- lto/lto-common.c  (revision 272846)
> +++ lto/lto-common.c  (working copy)
> @@ -568,8 +568,17 @@ lto_register_canonical_types_for_odr_typ
> 
>    /* Register all remaining types.  */
>    FOR_EACH_VEC_ELT (*types_to_register, i, t)
> -    if (!TYPE_CANONICAL (t))
> -      gimple_register_canonical_type (t);
> +    {
> +      /* For pre-streamed types like va-arg it is possible that main variant
> +      is !CXX_ODR_P while the variant (which is streamed) is.
> +      Copy CXX_ODR_P to make type verifier happy.  This is safe because
> +      in canonical type calculation we only consider main variants.
> +      However we can not change this flag before streaming is finished
> +      to not affect tree merging.  */
> +      TYPE_CXX_ODR_P (t) = TYPE_CXX_ODR_P (TYPE_MAIN_VARIANT (t));
> +      if (!TYPE_CANONICAL (t))
> +        gimple_register_canonical_type (t);
> +    }
>  }
> 
> 

Reply via email to