+2019-12-12 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch5.adb: (Analyze_Iterator_Specification): If the
+ iteration is over a slice, complete the resolution of its
+ bounds, which may be aebitrary expressions. The previous
+ pre-analysis may have created itypes for the slice but has not
+ performed the expansion that for example may introduce actions
+ that specify explicit dereferences and run-time checks.
+
2019-12-12 Ed Schonberg <schonberg@adacore.com>
* sem_ch8.adb: Improve error message for dispatching subprogram
Check_Reverse_Iteration (Typ);
end if;
+ -- For an element iteration over a slice, we must complete
+ -- the resolution and expansion of the slice bounds. These
+ -- can be arbitrary expressions, and the preanalysis that
+ -- was performed in preparation for the iteration may have
+ -- generated an itype whose bounds must be fully expanded.
+ -- We set the parent node to provide a proper insertion
+ -- point for generated actions, if any.
+
+ if Nkind (Iter_Name) = N_Slice
+ and then Nkind (Discrete_Range (Iter_Name)) = N_Range
+ and then not Analyzed (Discrete_Range (Iter_Name))
+ then
+ declare
+ Indx : constant Node_Id :=
+ Entity (First_Index (Etype (Iter_Name)));
+ begin
+ Set_Parent (Indx, Iter_Name);
+ Resolve (Scalar_Range (Indx), Etype (Indx));
+ end;
+ end if;
+
-- The name in the renaming declaration may be a function call.
-- Indicate that it does not come from source, to suppress
-- spurious warnings on renamings of parameterless functions,