public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-2214] [Ada] Crash on expansion of BIP construct in -gnatf mode
Date: Fri,  9 Jul 2021 12:39:44 +0000 (GMT)	[thread overview]
Message-ID: <20210709123944.A4A863AAB465@sourceware.org> (raw)

https://gcc.gnu.org/g:66d43665bc9c8a8f38531a8b9a02cfcfe129cc88

commit r12-2214-g66d43665bc9c8a8f38531a8b9a02cfcfe129cc88
Author: Justin Squirek <squirek@adacore.com>
Date:   Tue Jun 15 12:54:12 2021 -0400

    [Ada] Crash on expansion of BIP construct in -gnatf mode
    
    gcc/ada/
    
            * exp_ch6.adb (Is_Build_In_Place_Function_Call): Add check to
            verify the Selector_Name of Exp_Node has been analyzed before
            obtaining its entity.

Diff:
---
 gcc/ada/exp_ch6.adb | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index 1c56cb8b1d5..59704a4065c 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -8275,6 +8275,15 @@ package body Exp_Ch6 is
       --  This may be a call to a protected function.
 
       elsif Nkind (Name (Exp_Node)) = N_Selected_Component then
+         --  The selector in question might not have been analyzed due to a
+         --  previous error, so analyze it here to output the appropriate
+         --  error message instead of crashing when attempting to fetch its
+         --  entity.
+
+         if not Analyzed (Selector_Name (Name (Exp_Node))) then
+            Analyze (Selector_Name (Name (Exp_Node)));
+         end if;
+
          Function_Id := Etype (Entity (Selector_Name (Name (Exp_Node))));
 
       else


                 reply	other threads:[~2021-07-09 12:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210709123944.A4A863AAB465@sourceware.org \
    --to=pmderodat@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).