GNAT emits a warning on slices of the form "A (subtype)" if A is a
constant; a similar warning is now emitted if A is any object, e.g.
formal parameter, loop parameter (when iterating over an
array-of-arrays) or component.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* sem_eval.adb (Eval_Slice): Emit warning not just for
constants, but for any objects.
diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb
--- a/gcc/ada/sem_eval.adb
+++ b/gcc/ada/sem_eval.adb
@@ -3961,7 +3961,7 @@ package body Sem_Eval is
T : constant Entity_Id := Etype (E);
begin
- if Ekind (E) = E_Constant
+ if Is_Object (E)
and then Is_Array_Type (T)
and then Is_Entity_Name (Drange)
then