Richard, For some reason, your email is endeing up in a strange format, I almost missed the .patch file attached, making the review harder.
There's a typo in the comment added: + -- explicit limitedness implied by a synchronized private extension + -- the does not derive from a synchronized interface (see RM-7.3(6/2)). the -> that does not derive... OK with this change. > From: Richard Wai <rich...@annexi-strayline.com> > Sent: Thursday, August 10, 2023 12:55 AM > To: 'gcc-patches@gcc.gnu.org' <gcc-patches@gcc.gnu.org> > Cc: 'Eric Botcazou' <ebotca...@adacore.com>; 'Arnaud Charlet' > <char...@adacore.com>; 'Stephen Baird' <ba...@adacore.com> > Subject: [PATCH 1/2] Ada: Synchronized private extensions are always limited > > > > GNAT currently considers a synchronized private extension that derives from > an interface to be limited only when said interface is a concurrent > interface. However it is of course legal for a synchronized private > extension to derive from a limited interface. In this case GNAT fails to > correctly determine that the private extension is limited. > > > > This causes two separate problems that makes discriminated types in such a > case impossible: > > 1. GNAT inappropriately rejects compilation, claiming default > discriminants on such a private extension are illegal. > 2. GNAT fails to generate the expected discriminals for the > unconstrained discriminanted case, leading to the corresponding > discriminants of the "corresponding record" of the underlying concurrent > type to have no identifiers, and thus compilation fails. > > > > Fairly simple fix. If "synchronized" appears in the private extension > declaration, it is limited. This is explicit in the RM as well (7.3(6/2)). > > > > Fixing this bug uncovered of a related bug wrt. TSS address finalizer > generation for constrained subtypes of synchronized private extensions with > no default discriminants. That patch is to follow separately. > > > > Patch file is attached. > > > > -- Begin change log entry -- > > > > 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/ > > * sem_ch3.adb (Build_Derived_Record_Type): Treat presence of > keyword "synchronized" the same as "limited" when determining if a private > extension is limited. > > > -- End change log entry -- > > > This patch was bootstrapped on x86_64-*-freebsd13.2. Two new test cases were > added. Note that 4 gnat test cases fail currently on master and are > unrelated to this patch.