Warnings aare emitted when a declaration for a constant C has an address
aspect or an address_specification clause of the form O'Address, where
O is a previously declared entity that is not a constant, The warning
must br supppressed if O is a generic formal In_Parameter, which is a
constant within the generic unit.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* sem_ch13.adb (Analyze_Address_Specification_Clause): Do not
emit a warning when a constant declaration in a generic unit
overlays a generic In_Parameter.
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -6190,9 +6190,13 @@ package body Sem_Ch13 is
-- Issue an unconditional warning for a constant overlaying
-- a variable. For the reverse case, we will issue it only
-- if the variable is modified.
+ -- Within a generic unit an In_Parameter is a constant.
+ -- It can be instantiated with a variable, in which case
+ -- there will be a warning on the instance.
if Ekind (U_Ent) = E_Constant
and then Present (O_Ent)
+ and then Ekind (O_Ent) /= E_Generic_In_Parameter
and then not Overlays_Constant (U_Ent)
and then Address_Clause_Overlay_Warnings
then