diff options
author | Richard Wai <richard@annexi-strayline.com> | 2023-08-09 01:54:48 -0400 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-09-19 13:59:31 +0200 |
commit | eceb45bb2e0bf5518d9bd873e25a498456af8e1f (patch) | |
tree | 0f313acc75c84c5ee946c29ebc2557bb8109f89d /gcc/ada | |
parent | 5b945243c77e3ecd8dfab4b8b44f21daa3de8fe1 (diff) | |
download | gcc-eceb45bb2e0bf5518d9bd873e25a498456af8e1f.zip gcc-eceb45bb2e0bf5518d9bd873e25a498456af8e1f.tar.gz gcc-eceb45bb2e0bf5518d9bd873e25a498456af8e1f.tar.bz2 |
ada: Private extensions with the keyword "synchronized" are always limited.
GNAT was relying on synchronized private type extensions deriving from a
concurrent interface to determine its limitedness. This does not cover the case
where such an extension derives a limited interface. RM-7.6(6/2) makes is clear
that "synchronized" in a private extension implies the derived type is limited.
GNAT should explicitly check for the presence of "synchronized" in a private
extension declaration, and it should have the same effect as the presence of
“limited”.
gcc/ada/ChangeLog:
* sem_ch3.adb (Build_Derived_Record_Type): Treat presence of
keyword "synchronized" the same as "limited" when determining if a
private extension is limited.
gcc/testsuite/ChangeLog:
* gnat.dg/sync_tag_discriminals.adb: New test.
* gnat.dg/sync_tag_limited.adb: New test.
Signed-off-by: Richard Wai <richard@annexi-strayline.com>
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/sem_ch3.adb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 3262236..92902a7 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -9599,9 +9599,15 @@ package body Sem_Ch3 is -- AI-419: Limitedness is not inherited from an interface parent, so to -- be limited in that case the type must be explicitly declared as - -- limited. However, task and protected interfaces are always limited. - - if Limited_Present (Type_Def) then + -- limited, or synchronized. While task and protected interfaces are + -- always limited, a synchronized private extension might not inherit + -- from such interfaces, and so we also need to recognize the + -- explicit limitedness implied by a synchronized private extension + -- that does not derive from a synchronized interface (see RM-7.3(6/2)). + + if Limited_Present (Type_Def) + or else Synchronized_Present (Type_Def) + then Set_Is_Limited_Record (Derived_Type); elsif Is_Limited_Record (Parent_Type) |