diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2023-02-15 15:52:00 +0100 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-05-23 09:59:04 +0200 |
commit | 674ab59dc50bec6987f133424e4c5a1c5ba52e61 (patch) | |
tree | 0fb93c7a0a30b6320b9cfd78b4a6918c31ab7c93 /gcc/ada/sem_util.ads | |
parent | ea5a7a774a2d5d2759f45c77efa17a91182e614f (diff) |
ada: Fix internal error on quantified expression with predicated type
The problem is that the special function created by the compiler to check
the predicate does not inherit the public status of the type, because it
is generated as part of the freezing of the quantified expression, which
occurs from within a couple of intermediate internal scopes.
gcc/ada/
* sem_ch13.adb (Build_Predicate_Function_Declaration): Adjust the
commentary to the current implementation.
* sem_util.ads (Current_Scope_No_Loops): Move around.
(Current_Scope_No_Loops_No_Blocks): New declaration.
(Add_Block_Identifier): Fix formatting.
* sem_util.adb (Add_Block_Identifier): Likewise.
(Current_Scope_No_Loops_No_Blocks): New function.
(Set_Public_Status): Call Current_Scope_No_Loops_No_Blocks instead
of Current_Scope to get the current scope.
Diffstat (limited to 'gcc/ada/sem_util.ads')
-rw-r--r-- | gcc/ada/sem_util.ads | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads index 7bb8cdbe3f3..3edc158c749 100644 --- a/gcc/ada/sem_util.ads +++ b/gcc/ada/sem_util.ads @@ -639,18 +639,21 @@ package Sem_Util is function Current_Scope return Entity_Id; -- Get entity representing current scope + function Current_Scope_No_Loops return Entity_Id; + -- Return the current scope ignoring internally generated loops + + function Current_Scope_No_Loops_No_Blocks return Entity_Id; + -- Return the current scope ignoring internally generated loops and blocks + procedure Add_Block_Identifier - (N : Node_Id; - Id : out Entity_Id; - Scope : Entity_Id := Current_Scope); + (N : Node_Id; + Id : out Entity_Id; + Scope : Entity_Id := Current_Scope); -- Given a block statement N, generate an internal E_Block label and make -- it the identifier of the block. Scope denotes the scope in which the -- generated entity Id is created and defaults to the current scope. If the -- block already has an identifier, Id returns the entity of its label. - function Current_Scope_No_Loops return Entity_Id; - -- Return the current scope ignoring internally generated loops - function Current_Subprogram return Entity_Id; -- Returns current enclosing subprogram. If Current_Scope is a subprogram, -- then that is what is returned, otherwise the Enclosing_Subprogram of the |