public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-7848] ada: Fix internal error on chain of predicated record types
@ 2023-09-27 8:23 Eric Botcazou
0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2023-09-27 8:23 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:a5c70fc77a71a1b5dc5ace0129da9e361acb79e3
commit r13-7848-ga5c70fc77a71a1b5dc5ace0129da9e361acb79e3
Author: Eric Botcazou <ebotcazou@adacore.com>
Date: Fri Jan 27 15:13:07 2023 +0100
ada: Fix internal error on chain of predicated record types
The preanalysis of a predicate set on one of the record types was causing
premature freezing of another record type.
gcc/ada/
* sem_ch13.adb: Add with and use clauses for Expander.
(Resolve_Aspect_Expressions) <Aspect_Predicate>: Emulate a
bona-fide preanalysis setup before calling
Resolve_Aspect_Expression.
Diff:
---
gcc/ada/sem_ch13.adb | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index 0d311ca80b4..7a9045432bb 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -38,6 +38,7 @@ with Exp_Ch3; use Exp_Ch3;
with Exp_Disp; use Exp_Disp;
with Exp_Tss; use Exp_Tss;
with Exp_Util; use Exp_Util;
+with Expander; use Expander;
with Freeze; use Freeze;
with Ghost; use Ghost;
with Lib; use Lib;
@@ -15556,15 +15557,29 @@ package body Sem_Ch13 is
-- Preanalyze expression after type replacement to catch
-- name resolution errors if the predicate function has
-- not been built yet.
+
-- Note that we cannot use Preanalyze_Spec_Expression
- -- because of the special handling required for
- -- quantifiers, see comments on Resolve_Aspect_Expression
- -- above.
+ -- directly because of the special handling required for
+ -- quantifiers (see comments on Resolve_Aspect_Expression
+ -- above) but we need to emulate it properly.
if No (Predicate_Function (E)) then
- Push_Type (E);
- Resolve_Aspect_Expression (Expr);
- Pop_Type (E);
+ declare
+ Save_In_Spec_Expression : constant Boolean :=
+ In_Spec_Expression;
+ Save_Full_Analysis : constant Boolean :=
+ Full_Analysis;
+ begin
+ In_Spec_Expression := True;
+ Full_Analysis := False;
+ Expander_Mode_Save_And_Set (False);
+ Push_Type (E);
+ Resolve_Aspect_Expression (Expr);
+ Pop_Type (E);
+ Expander_Mode_Restore;
+ Full_Analysis := Save_Full_Analysis;
+ In_Spec_Expression := Save_In_Spec_Expression;
+ end;
end if;
when Pre_Post_Aspects =>
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-09-27 8:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-27 8:23 [gcc r13-7848] ada: Fix internal error on chain of predicated record types Eric Botcazou
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).