On Fri, Oct 10, 2014 at 10:38 AM, Eric Botcazou <ebotca...@adacore.com> wrote: >> 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?
Yes, that works for me. Thanks, Richard. > -- > Eric Botcazou