public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-3693] ada: Fix crash on selected component lookup in generic instance
@ 2023-09-05 11:09 Marc Poulhi?s
  0 siblings, 0 replies; only message in thread
From: Marc Poulhi?s @ 2023-09-05 11:09 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:d54e996a25d34d1cfaa5fd1de5127668bb43755a

commit r14-3693-gd54e996a25d34d1cfaa5fd1de5127668bb43755a
Author: Bob Duff <duff@adacore.com>
Date:   Wed Aug 23 08:14:07 2023 -0400

    ada: Fix crash on selected component lookup in generic instance
    
    This patch fixes a compiler crash on selected component lookup in an instance
    of a generic unit when the relevant type is an itype.
    
    gcc/ada/
    
            * sem_ch4.adb (Find_Component_In_Instance): Check that
            Declaration_Node (Par) is not Empty, as it is for itypes.

Diff:
---
 gcc/ada/sem_ch4.adb | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 8543f0d578bc..50ba6c9c847c 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -5212,10 +5212,14 @@ package body Sem_Ch4 is
             end if;
          end loop;
 
-         if Present (Par) and then Is_Generic_Actual_Type (Par) then
-
-            --  Now look for component in ancestor types
+         --  If Par is a generic actual, look for component in ancestor types.
+         --  Skip this if we have no Declaration_Node, as is the case for
+         --  itypes.
 
+         if Present (Par)
+           and then Is_Generic_Actual_Type (Par)
+           and then Present (Declaration_Node (Par))
+         then
             Par := Generic_Parent_Type (Declaration_Node (Par));
             loop
                Find_Component_In_Instance (Par);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-09-05 11:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-05 11:09 [gcc r14-3693] ada: Fix crash on selected component lookup in generic instance 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).