aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2023-07-05 19:49:40 +0200
committerMarc Poulhiès <poulhies@adacore.com>2023-07-18 15:11:47 +0200
commit6c431c90947cb5a18d2b8807d5a94c644bd7021c (patch)
treebd7c07946eb4d33c76fa7a53499a40799c56dec9
parent79cc2a75680ebcf8e9e200ddfbd61bd3ef08798a (diff)
downloadgcc-6c431c90947cb5a18d2b8807d5a94c644bd7021c.zip
gcc-6c431c90947cb5a18d2b8807d5a94c644bd7021c.tar.gz
gcc-6c431c90947cb5a18d2b8807d5a94c644bd7021c.tar.bz2
ada: Fix assertion failure introduced by latest change
The new processing is not properly guarded. gcc/ada/ * sem_ch13.adb (Replace_Type_References_Generic.Visible_Component): In the case of private discriminated types, explicitly check that we have a private declaration before examining its discriminant part.
-rw-r--r--gcc/ada/sem_ch13.adb9
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index 4f97094..585c0f3 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -15593,8 +15593,6 @@ package body Sem_Ch13 is
elsif Is_Private_Type (T) and then Has_Discriminants (T) then
declare
Decl : constant Node_Id := Declaration_Node (T);
- Spec : constant List_Id :=
- Discriminant_Specifications (Original_Node (Decl));
Discr : Node_Id;
@@ -15604,8 +15602,11 @@ package body Sem_Ch13 is
-- name; then, if it exists, return the discriminant entity of
-- the same name in the type, which is that of its full view.
- if Present (Spec) then
- Discr := First (Spec);
+ if Nkind (Decl) in N_Private_Extension_Declaration
+ | N_Private_Type_Declaration
+ and then Present (Discriminant_Specifications (Decl))
+ then
+ Discr := First (Discriminant_Specifications (Decl));
while Present (Discr) loop
if Chars (Defining_Identifier (Discr)) = Comp then