[Ada] Do not clear Is_True_Constant flag on imported constants
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 16 Mar 2021 09:24:39 +0000 (10:24 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Fri, 18 Jun 2021 08:36:48 +0000 (04:36 -0400)
gcc/ada/

* sem_prag.adb (Process_Import_Or_Interface): Do not
artificially record a possible modification for a constant.

gcc/ada/sem_prag.adb

index 3e6af33..4efb3fb 100644 (file)
@@ -9136,7 +9136,10 @@ package body Sem_Prag is
 
             Def_Id := Entity (Def_Id);
             Kill_Size_Check_Code (Def_Id);
-            Note_Possible_Modification (Get_Pragma_Arg (Arg1), Sure => False);
+            if Ekind (Def_Id) /= E_Constant then
+               Note_Possible_Modification
+                 (Get_Pragma_Arg (Arg1), Sure => False);
+            end if;
 
          else
             Process_Convention (C, Def_Id);
@@ -9146,7 +9149,10 @@ package body Sem_Prag is
 
             Mark_Ghost_Pragma (N, Def_Id);
             Kill_Size_Check_Code (Def_Id);
-            Note_Possible_Modification (Get_Pragma_Arg (Arg2), Sure => False);
+            if Ekind (Def_Id) /= E_Constant then
+               Note_Possible_Modification
+                 (Get_Pragma_Arg (Arg2), Sure => False);
+            end if;
          end if;
 
          --  Various error checks