On Tue, Oct 7, 2014 at 10:04 AM, Eric Botcazou <ebotca...@adacore.com> wrote: >> Testcase? I think it would be better to handle this in the canonical type >> merging code in lto.c - or how does it end up working without LTO? That is, >> what does the Ada frontend do to make sure get_alias_set handles this >> correctly? > > It manages the alias sets, see gcc-interface/utils.c:relate_alias_sets.
Ugh :/ 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? 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. 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)? Thanks, Richard. > -- > Eric Botcazou