From a5aac267e64c578d55e6e269fa9e331f0d01da98 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 11 Mar 2020 10:47:34 +0100 Subject: Fix internal error on locally-defined subpools If the type is derived in the current compilation unit, and Allocate is not overridden on derivation (as is typically the case with Root_Storage_Pool_With_Subpools), the entity for Allocate of the derived type is an alias for System.Storage_Pools.Subpools.Allocate. The main assertion in gnat_to_gnu_entity fails in this case, since this is not a definition and Is_Public is false (since the entity is nested in the same compilation unit). 2020-03-11 Richard Wai * gcc-interface/decl.c (gnat_to_gnu_entity): Also test Is_Public on the Alias of the entitiy, if is present, in the main assertion. --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/gcc-interface/decl.c | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'gcc/ada') diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 64b2572..9df3840 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2020-03-11 Richard Wai + + * gcc-interface/decl.c (gnat_to_gnu_entity): Also test Is_Public on + the Alias of the entitiy, if is present, in the main assertion. + 2020-02-06 Alexandre Oliva * raise-gcc.c (personality_body) [__ARM_EABI_UNWINDER__]: diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 871a309..80dfc55 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -446,7 +446,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) /* If we get here, it means we have not yet done anything with this entity. If we are not defining it, it must be a type or an entity that is defined - elsewhere or externally, otherwise we should have defined it already. */ + elsewhere or externally, otherwise we should have defined it already. + + One exception is for an entity, typically an inherited operation, which is + a local alias for the parent's operation. It is neither defined, since it + is an inherited operation, nor public, since it is declared in the current + compilation unit, so we test Is_Public on the Alias entity instead. */ gcc_assert (definition || is_type || kind == E_Discriminant @@ -454,6 +459,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) || kind == E_Label || (kind == E_Constant && Present (Full_View (gnat_entity))) || Is_Public (gnat_entity) + || (Present (Alias (gnat_entity)) + && Is_Public (Alias (gnat_entity))) || type_annotate_only); /* Get the name of the entity and set up the line number and filename of -- cgit v1.1 From e835226bab5b3575c8a55c048dcfed3d4cde5e0e Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 11 Mar 2020 11:29:39 +0100 Subject: Fix GIMPLE verification failure in LTO mode on Ada code The issue is that tree_is_indexable doesn't return the same result for a FIELD_DECL with QUAL_UNION_TYPE and the QUAL_UNION_TYPE, resulting in two instances of the QUAL_UNION_TYPE in the bytecode. The result for the type is the correct one (false, since it is variably modified) while the result for the field is falsely true because: else if (TREE_CODE (t) == FIELD_DECL && lto_variably_modified_type_p (DECL_CONTEXT (t))) return false; is not satisfied. The reason for this is that the DECL_QUALIFIER of fields of a QUAL_UNION_TYPE depends on a discriminant in Ada, which means that the size of the type does too (CONTAINS_PLACEHOLDER_P), which in turn means that it is reset to a mere PLACEHOLDER_EXPR by free_lang_data, which finally means that the size of DECL_CONTEXT is too, so RETURN_TRUE_IF_VAR is false. In other words, the CONTAINS_PLACEHOLDER_P property of the DECL_QUALIFIER of fields of a QUAL_UNION_TYPE hides the variably_modified_type_p property of these fields, if you look from the outside. PR middle-end/93961 * tree.c (variably_modified_type_p) : Recurse into fields whose type is a qualified union. --- gcc/ada/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/ada') diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 9df3840..5349fd9 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,7 +1,7 @@ 2020-03-11 Richard Wai * gcc-interface/decl.c (gnat_to_gnu_entity): Also test Is_Public on - the Alias of the entitiy, if is present, in the main assertion. + the Alias of the entitiy, if it is present, in the main assertion. 2020-02-06 Alexandre Oliva -- cgit v1.1