This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Fix miscompilation of gnat1 in LTO bootstrap
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 10 Oct 2014 10:38:38 +0200
- Subject: Re: [patch] Fix miscompilation of gnat1 in LTO bootstrap
- Authentication-results: sourceware.org; auth=none
- References: <1553466 dot Fmh6GVef6h at polaris> <1860810 dot 1P47kgm7eF at polaris> <CAFiYyc3PnF1o0xhV6y+s4sB-Gyw7z244oi0K5f+0+RZMpxq_ug at mail dot gmail dot com>
> I can't see how this can work with LTO. We need a middle-end way
> to represent the alias relation of those types. At least I can't see how
> your simple patch covers all cases here?
It covers what I think is the most prominent case (unconstrained array types),
the other cases are far less annoying in practice.
> With LTO we preserve TYPE_ALIAS_SET == 0, so another way to
> fix this (and which I'd like more) is to do your patch in the Ada frontend,
> that is, use alias-set zero for all types you relate if flag_lto.
Really Big Hammer if you ask me.
> Another way is to make LTO canonical type merging handle the
> case of type_contains_placeholder_p "better", that is by treating
> two types with those equivalent more easily. For arrays this simply
> means hashing and comparing non-constant TYPE_DOMAIN the
> same / as equal. There is already some code handling PLACEHODER_EXPR
> special, but it doesn't seem to be enough (why in this case)?
Yes, gimple_canonical_types_compatible_p will return true for a couple of
unconstrained (i.e. type_contains_placeholder_p) array types with the same
component type. The problem here is for an unconstrained array type and a
constrained (regular) array type with the same component type. Can I modify
gimple_canonical_types_compatible_p to return true in that case as well?
--
Eric Botcazou