-- Reset to False if at least one operand is encountered which is known
-- at compile time to be non-null. Used for handling the special case
-- of setting the high bound to the last operand high bound for a null
- -- result, thus ensuring a proper high bound in the super-flat case.
+ -- result, thus ensuring a proper high bound in the superflat case.
N : constant Nat := List_Length (Opnds);
-- Number of concatenation operands including possibly null operands
-- Local Declarations
Opnd_Typ : Entity_Id;
- Slice_Rng : Entity_Id;
- Subtyp_Ind : Entity_Id;
+ Slice_Rng : Node_Id;
+ Subtyp_Ind : Node_Id;
+ Subtyp_Rng : Node_Id;
Ent : Entity_Id;
Len : Unat;
J : Nat;
-- Handle the exceptional case where the result is null, in which case
-- case the bounds come from the last operand (so that we get the proper
- -- bounds if the last operand is super-flat).
+ -- bounds if the last operand is superflat).
if Result_May_Be_Null then
Low_Bound :=
Slice_Rng := Empty;
end if;
+ Subtyp_Rng := Make_Range (Loc, Low_Bound, High_Bound);
+
+ -- If the result cannot be null then the range cannot be superflat
+
+ Set_Cannot_Be_Superflat (Subtyp_Rng, not Result_May_Be_Null);
+
-- Now we construct an array object with appropriate bounds. We mark
-- the target as internal to prevent useless initialization when
-- Initialize_Scalars is enabled. Also since this is the actual result
Subtype_Mark => New_Occurrence_Of (Atyp, Loc),
Constraint =>
Make_Index_Or_Discriminant_Constraint (Loc,
- Constraints => New_List (
- Make_Range (Loc,
- Low_Bound => Low_Bound,
- High_Bound => High_Bound))));
+ Constraints => New_List (Subtyp_Rng)));
Ent := Make_Temporary (Loc, 'S');
Set_Is_Internal (Ent);
Cc (N_Range, N_Subexpr,
(Sy (Low_Bound, Node_Id),
Sy (High_Bound, Node_Id),
- Sy (Includes_Infinities, Flag)));
+ Sm (Cannot_Be_Superflat, Flag),
+ Sm (Includes_Infinities, Flag)));
Cc (N_Reference, N_Subexpr,
(Sy (Prefix, Node_Id)));
-- a pragma Import or Interface applies, in which case no body is
-- permitted (in Ada 83 or Ada 95).
+ -- Cannot_Be_Superflat
+ -- This flag is present in N_Range nodes. It is set if the range is of a
+ -- discrete type and cannot be superflat, i.e. it is guaranteed that the
+ -- inequality High_Bound >= Low_Bound - 1 is true. At the time of this
+ -- writing, it is only used by the code generator to streamline things.
+
-- Cleanup_Actions
-- Present in block statements created for transient blocks, contains
-- additional cleanup actions carried over from the transient scope.
-- Sloc points to ..
-- Low_Bound
-- High_Bound
+ -- Cannot_Be_Superflat
-- Includes_Infinities
-- plus fields for expression