This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Last part of verify_type_vairant checks
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: gcc-patches at gcc dot gnu dot org, Pierre-Marie de Rodat <derodat at adacore dot com>
- Date: Fri, 15 May 2015 23:19:15 +0200
- Subject: Re: Last part of verify_type_vairant checks
- Authentication-results: sourceware.org; auth=none
- References: <20150515030118 dot GC85226 at kam dot mff dot cuni dot cz>
> - Ada builds !TYPE_ARTIFICIAL variant of TYPE_ARTIFICIAL type.
> Eric, I can not really make sense of this. Is this expected?
> If we have artificial type, how it can become not?
Yes, that's a bit unexpected and probably comes from the case where we build a
variant and it's not really appropriate to do so (gnat_pushdecl):
/* ??? Copy and original type are not supposed to be variant but we
really need a variant for the placeholder machinery to work. */
if (TYPE_IS_FAT_POINTER_P (t))
tt = build_variant_type_copy (t);
else
{
/* TYPE_NEXT_PTR_TO is a chain of main variants. */
tt = build_distinct_type_copy (TYPE_MAIN_VARIANT (t));
if (TREE_CODE (t) == POINTER_TYPE)
TYPE_NEXT_PTR_TO (TYPE_MAIN_VARIANT (t)) = tt;
tt = build_qualified_type (tt, TYPE_QUALS (t));
}
On the other hand, if the type declared in the source code is volatile, one
could imagine that the non-volatile main variant be TYPE_ARTIFICIAL and the
declared type be !TYPE_ARTIFICIAL.
> - During Ada builds there are types that differ in TYPE_SIZES_GIMPLIFIED.
> This is probably harmless but I am not sure it ishappen to happen.
That it's harmless I'm sure, otherwise it would already have bitten us. :-)
But I agree that it would be better to always gimplify the main variant first
and propagate to the other variants, as done in gimplify_type_sizes.
If you have a patchlet for this one, you can open a PR and attach it.
--
Eric Botcazou