[Ada] Subtype inherits Atomic flag from base type
authorEd Schonberg <schonberg@adacore.com>
Wed, 5 Feb 2020 16:38:38 +0000 (11:38 -0500)
committerPierre-Marie de Rodat <derodat@adacore.com>
Fri, 5 Jun 2020 12:17:53 +0000 (08:17 -0400)
2020-06-05  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* sem_ch3.adb (Analyze_Subtype_Declaration): For scalar types,
and for subtype declarations without a constraint, subtype
inherits Atomic flag from base type.

gcc/ada/sem_ch3.adb

index 3c65a34..4d6382e 100644 (file)
@@ -5804,6 +5804,15 @@ package body Sem_Ch3 is
          end if;
       end if;
 
+      --  If the base type is a scalar type, or else if there is no
+      --  constraint, the atomic flag is inherited by the subtype.
+
+      if Is_Scalar_Type (Id)
+        or else Is_Entity_Name (Subtype_Indication (N))
+      then
+         Set_Is_Atomic (Id, Is_Atomic (T));
+      end if;
+
       --  Remaining processing depends on characteristics of base type
 
       T := Etype (Id);