From: "Marc Poulhiès" <poulhies@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Justin Squirek <squirek@adacore.com>
Subject: [COMMITTED] ada: Spurious error on Lock_Free protected type with discriminants
Date: Thu, 5 Jan 2023 15:39:12 +0100 [thread overview]
Message-ID: <20230105143912.155630-1-poulhies@adacore.com> (raw)
From: Justin Squirek <squirek@adacore.com>
This patch corrects an issue in the compiler whereby unprefixed discriminants
appearing in protected subprograms were unable to be properly resolved -
leading to spurious resolution errors.
gcc/ada/
* sem_ch8.adb (Set_Entity_Or_Discriminal): Verify we are actually
resetting the entity field of a non-prefixed discriminant
reference.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/sem_ch8.adb | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index 841076bbd01..fe89e1127ee 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -4891,14 +4891,16 @@ package body Sem_Ch8 is
then
null;
- -- Don't replace the discriminant in strict preanalysis mode since
- -- it can lead to errors during full analysis when the discriminant
- -- gets referenced later.
+ -- Don't replace a non-qualified discriminant in strict preanalysis
+ -- mode since it can lead to errors during full analysis when the
+ -- discriminant gets referenced later.
-- This can occur in situations where a protected type contains
- -- an expression function which references a discriminant.
+ -- an expression function which references a non-prefixed
+ -- discriminant.
- elsif Preanalysis_Active
+ elsif No (P)
+ and then Preanalysis_Active
and then Inside_Preanalysis_Without_Freezing = 0
then
null;
--
2.34.1
next reply other threads:[~2023-01-05 14:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-05 14:39 Marc Poulhiès [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-11-24 10:12 Marc Poulhiès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230105143912.155630-1-poulhies@adacore.com \
--to=poulhies@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=squirek@adacore.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).