aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/einfo.ads
diff options
context:
space:
mode:
authorGary Dismukes <dismukes@adacore.com>2021-03-05 02:20:09 -0500
committerPierre-Marie de Rodat <derodat@adacore.com>2021-06-17 10:32:16 -0400
commitd32db3a763249a8b94c2e2e285fc6f400eadea4e (patch)
tree834f149ad26966000533a1dcefd502b5c07fa11e /gcc/ada/einfo.ads
parent4892e31daceb8ab230768a15eb0a01b814e8bbfd (diff)
downloadgcc-d32db3a763249a8b94c2e2e285fc6f400eadea4e.zip
gcc-d32db3a763249a8b94c2e2e285fc6f400eadea4e.tar.gz
gcc-d32db3a763249a8b94c2e2e285fc6f400eadea4e.tar.bz2
[Ada] Implementation of Inox feature of fixed lower bounds on array types/subtypes
gcc/ada/ * checks.adb (Discrete_Range_Cond): For an index subtype that has a fixed lower bound, require that the range's lower bound match that of the subtype. (Selected_Range_Checks): Warn about the case where a static lower bound does not equal an index subtype's fixed lower bound. * einfo.ads (Is_Fixed_Lower_Bound_Array_Subtype, Is_Fixed_Lower_Bound_Index_Subtype): Document new entity flag. * exp_ch4.adb (Expand_N_Type_Conversion): If the operand is of an unconstrained array subtype with fixed lower bound, then Expand_Sliding_Conversion is applied to the operand. * exp_ch6.adb (Expand_Simple_Function_Return): If the result subtype is an unconstrained array subtype with fixed lower bound, then Expand_Sliding_Conversion is applied to the return object. * exp_util.ads (Expand_Sliding_Conversion): New procedure for applying a sliding subtype conversion to an array object of a fixed-lower-bound subtype when needed. * exp_util.adb: Add with_clause for Freeze. (Expand_Sliding_Conversion): New procedure for applying a sliding subtype conversion to an array object of a fixed-lower-bound subtype when needed. It traverses the indexes of the unconstrained array type/subtype to create a target constrained subtype and rewrites the array object to be a conversion to that subtype, when there's at least one index whose lower bound does not statically match the fixed-lower bound of the target subtype. * gen_il-fields.ads (type Opt_Field_Enum): Add literals Is_Fixed_Lower_Bound_Array_Subtype and Is_Fixed_Lower_Bound_Index_Subtype for new flags on type entities. * gen_il-gen-gen_entities.adb: Add calls to Create_Semantic_Field for the new fixed-lower-bound flags on type entities. * par-ch3.adb (P_Array_Type_Definition): Add handling for parsing of fixed-lower-bound index ranges in unconstrained array types. Report an error if such an index is encountered and GNAT language extensions are not enabled. (P_Index_Subtype_Def_With_Fixed_Lower_Bound): Support procedure for parsing unconstrained index ranges. (P_Index_Or_Discriminant_Constraint): Add handling for parsing of index constraints that specify ranges with fixed lower bounds. Report an error if such an index is encountered and GNAT language extensions are not enabled. * sem_ch3.adb (Analyze_Object_Declaration): If the object's nominal subtype is an array subtype with fixed lower bound, then Expand_Sliding_Conversion is applied to the object. (Array_Type_Declaration): Mark the array type and the subtypes of any indexes that specify a fixed lower bound as being fixed-lower-bound subtypes, and set the High_bound of the range of such an index to the upper bound of the named subtype. (Constrain_Array): For an array subtype with one or more index ranges specifying a fixed lower bound, set Is_Constrained to False and set the array subtype's Is_Fixed_Lower_Bound_Array_Subtype flag to True. (Constrain_Index): Mark the subtypes of an index that specifies a fixed lower bound as being a fixed-lower-bound index subtype, and set the High_bound of the range of such an index to the upper bound of the base type of the array type's corresponding index. * sem_res.adb (Resolve_Actuals): If a formal is of an unconstrained array subtype with fixed lower bound, then Expand_Sliding_Conversion is applied to the actual. * sem_util.adb (Build_Actual_Subtype): If the actual subtype corresponds to an unconstrained array subtype having any indexes with fixed lower bounds, then set the lower bounds of any such indexes of the actual subtype to the appropriate fixed lower bound of the formal subtype (rather than taking it from the formal itself). * sprint.adb (Sprint_Node_Actual, case N_Range): If a range's Etype has a fixed lower bound, then print "<>" rather than the High_Bound of the range.
Diffstat (limited to 'gcc/ada/einfo.ads')
-rw-r--r--gcc/ada/einfo.ads10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads
index fe9bf72..55cf83d 100644
--- a/gcc/ada/einfo.ads
+++ b/gcc/ada/einfo.ads
@@ -2589,6 +2589,16 @@ package Einfo is
-- an anonymous base type (e.g. for integer type declarations or
-- constrained array declarations).
+-- Is_Fixed_Lower_Bound_Array_Subtype
+-- Defined in type entities. True for unconstrained array types and
+-- subtypes where at least one index has a range specified with a fixed
+-- lower bound (range syntax is "<expression> .. <>").
+
+-- Is_Fixed_Lower_Bound_Index_Subtype
+-- Defined in type entities. True for an index of an unconstrained array
+-- type or subtype whose range is specified with a fixed lower bound
+-- (range syntax is "<expression> .. <>").
+
-- Is_Fixed_Point_Type (synthesized)
-- Applies to all entities, true for decimal and ordinary fixed
-- point types and subtypes.