]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Incorrect Reinit_Field_To_Zero calls for concurrent entities
authorBob Duff <duff@adacore.com>
Sun, 14 Feb 2021 20:27:12 +0000 (15:27 -0500)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 15 Jun 2021 10:19:36 +0000 (06:19 -0400)
gcc/ada/

* sem_ch3.adb (Make_Class_Wide_Type): Make sure all the calls to
Reinit_Field_To_Zero are for the correct Ekinds.

gcc/ada/sem_ch3.adb

index 11c6fdbed6b8c81c5caa8d8b1ae5901e71efea3b..03280e5244e8ef774cca663069e1487d3f026636 100644 (file)
@@ -19239,14 +19239,17 @@ package body Sem_Ch3 is
          Reinit_Field_To_Zero (CW_Type, Private_Dependents);
 
       elsif Ekind (CW_Type) in Concurrent_Kind then
-         if Ekind (CW_Type) = E_Task_Type then
+         Reinit_Field_To_Zero (CW_Type, First_Private_Entity);
+         Reinit_Field_To_Zero (CW_Type, Scope_Depth_Value);
+
+         if Ekind (CW_Type) in Task_Kind then
             Reinit_Field_To_Zero (CW_Type, Is_Elaboration_Checks_OK_Id);
             Reinit_Field_To_Zero (CW_Type, Is_Elaboration_Warnings_OK_Id);
          end if;
 
-         Reinit_Field_To_Zero (CW_Type, First_Private_Entity);
-         Reinit_Field_To_Zero (CW_Type, Scope_Depth_Value);
-         Reinit_Field_To_Zero (CW_Type, SPARK_Aux_Pragma_Inherited);
+         if Ekind (CW_Type) in E_Task_Type | E_Protected_Type then
+            Reinit_Field_To_Zero (CW_Type, SPARK_Aux_Pragma_Inherited);
+         end if;
       end if;
 
       Mutate_Ekind                    (CW_Type, E_Class_Wide_Type);