On April 19, 2017 7:56:30 AM GMT+02:00, Jakub Jelinek <ja...@redhat.com> wrote:
>On Wed, Apr 19, 2017 at 07:45:36AM +0200, Richard Biener wrote:
>> >As mentioned in the PR, we now use TYPE_TYPELESS_STORAGE flag on
>> >ARRAY_TYPEs to denote types that need the special C++ alias
>> >The problem is how is that created, we just use build_array_type and
>> >set TYPE_TYPELESS_STORAGE on the result, but build_array_type uses
>> >caching, so we might modify that way some other array type.
>> >If all the array type creation goes through build_cplus_array_type,
>> >wouldn't be a problem, as that flag is dependent just on the element
>> >type, but that is not the case, c-family as well as the middle-end
>> >lots of spots that also create array types. So in the end whether
>> >one gets TYPE_TYPELESS_STORAGE flag or not is quite random, depends
>> >GC etc.
>> >The following patch attempts to resolve this, by making the type
>> >take that flag into account. Bootstrapped/regtested on x86_64-linux
>> >i686-linux, ok for trunk?
>> When changing the C++ function I thought that calling
>> wrong and it should instead do the same it does in the other places,
>> its raw creation routine and then the canonical type register stuff.
>> I was hesitant to change this at this point.
>The problem is that as the patch shows, we don't need it in a single
>(the C++ FE), but at least in two places (C++ FE and c-family), and it
>wouldn't surprise me if we don't need it later on in further places
>(e.g. in middle-end, if we have a TYPE_TYPELESS_STORAGE array and say
>wants to create a smaller one with the same property).
Hmm, but the C++ FE largely avoids the type cache of the Me and uses its own.
Apart from a single place in this function.
But as I said I'm AFK and can't really check.
>Using a default argument to build_array_type is likely cleaner indeed,
>I'd just then also swap the arguments to build_array_type_1 (the shared
Sure. With C++ there's no reason to export _1 variants. Either overloading or
default args work for me here.