aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sinfo.ads
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2023-11-22 16:29:01 +0100
committerMarc Poulhiès <poulhies@adacore.com>2023-12-19 15:27:48 +0100
commitcdd8f4b3f2457ff1699b870100acd6c90ca30842 (patch)
tree1c697bdbad7318108b3add5a66afc6af6d18b312 /gcc/ada/sinfo.ads
parent64a485df891c615b9a9744589c0a36beb38604b3 (diff)
downloadgcc-cdd8f4b3f2457ff1699b870100acd6c90ca30842.zip
gcc-cdd8f4b3f2457ff1699b870100acd6c90ca30842.tar.gz
gcc-cdd8f4b3f2457ff1699b870100acd6c90ca30842.tar.bz2
ada: Fix spurious visibility error on parent's component in instance
This occurs for an aggregate of a derived tagged type in the body of the instance, because the full view of the parent type, which was visible in the generic construct (otherwise the aggregate would have been illegal), is not restored in the body of the instance. Copy_Generic_Node already contains code to restore the full view in this case, but it works only if the derived tagged type is itself global to the generic construct, and not if the derived tagged type is local but the parent type global, as is the case here. gcc/ada/ * gen_il-fields.ads (Aggregate_Bounds): Rename to Aggregate_Bounds_Or_Ancestor_Type. * gen_il-gen-gen_nodes.adb (Aggregate_Bounds): Likewise. * sem_aggr.adb (Resolve_Record_Aggregate): Remove obsolete bypass. * sem_ch12.adb (Check_Generic_Actuals): Add decoration. (Copy_Generic_Node): For an extension aggregate, restore only the full view, if any. For a full aggregate, restore the full view as well as that of its Ancestor_Type, if any, and up to the root type. (Save_References_In_Aggregate): For a full aggregate of a local derived tagged type with a global ancestor, set Ancestor_Type to this ancestor. For a full aggregate of a global derived tagged type, set Ancestor_Type to the parent type. * sinfo-utils.ads (Aggregate_Bounds): New function renaming. (Ancestor_Type): Likewise. (Set_Aggregate_Bounds): New procedure renaming. (Set_Ancestor_Type): Likewise. * sinfo.ads (Ancestor_Type): Document new field.
Diffstat (limited to 'gcc/ada/sinfo.ads')
-rw-r--r--gcc/ada/sinfo.ads7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads
index 1a63170..fc4589d 100644
--- a/gcc/ada/sinfo.ads
+++ b/gcc/ada/sinfo.ads
@@ -845,6 +845,11 @@ package Sinfo is
-- is used for translation of the at end handler into a normal exception
-- handler.
+ -- Ancestor_Type
+ -- Present in record N_Aggregate nodes. Used to store the first global
+ -- ancestor of the type of the aggregate in a generic context, if any,
+ -- when the type is a derived tagged type. Otherwise Empty.
+
-- Aspect_On_Partial_View
-- Present on an N_Aspect_Specification node. For an aspect that applies
-- to a type entity, indicates whether the specification appears on the
@@ -4081,7 +4086,7 @@ package Sinfo is
-- Expressions (set to No_List if none or null record case)
-- Component_Associations (set to No_List if none)
-- Null_Record_Present
- -- Aggregate_Bounds
+ -- Aggregate_Bounds (array) or Ancestor_Type (record)
-- Associated_Node
-- Compile_Time_Known_Aggregate
-- Expansion_Delayed