* [COMMITTED] ada: Fix assertion failure introduced by latest change
@ 2023-07-18 13:13 Marc Poulhiès
0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2023-07-18 13:13 UTC (permalink / raw)
To: gcc-patches; +Cc: Eric Botcazou
From: Eric Botcazou <ebotcazou@adacore.com>
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.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/sem_ch13.adb | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index 4f97094aae5..585c0f33d8b 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
--
2.40.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-07-18 13:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-18 13:13 [COMMITTED] ada: Fix assertion failure introduced by latest change Marc Poulhiès
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).