public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kargl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/103312] [9/10/11/12 Regression] ICE in gfc_find_component since r9-1098-g3cf89a7b992d483e
Date: Fri, 19 Nov 2021 17:15:24 +0000	[thread overview]
Message-ID: <bug-103312-4-GZkhF60KtG@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103312-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103312

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|kargl at gcc dot gnu.org           |

--- Comment #2 from kargl at gcc dot gnu.org ---
Not regression tested.  Allows the code to compile.

I don't use CLASS, so have not idea if this is correct.
The code in gfc_find_component is set up for only TYPE,
UNION, and STRUCT.  See the assert.

diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
index 93118ad3455..997fa0d7848 100644
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -1692,8 +1692,10 @@ generate_finalization_wrapper (gfc_symbol *derived,
gfc_namespace *ns,
   final->attr.artificial = 1;
   final->attr.always_explicit = 1;
   final->attr.if_source = expr_null_wrapper ? IFSRC_IFBODY : IFSRC_DECL;
-  if (ns->proc_name->attr.flavor == FL_MODULE)
+
+  if (ns->proc_name && ns->proc_name->attr.flavor == FL_MODULE)
     final->module = ns->proc_name->name;
+
   gfc_set_sym_referenced (final);
   gfc_commit_symbol (final);

diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index 8c9a1d00ce0..52d47b8b872 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -2492,6 +2492,8 @@ gfc_find_component (gfc_symbol *sym, const char *name,

   if (sym->attr.flavor == FL_DERIVED)
     sym = gfc_use_derived (sym);
+  else if (sym->ts.type == BT_DERIVED)
+    sym = gfc_use_derived (sym->ts.u.derived);
   else
     gcc_assert (gfc_fl_struct (sym->attr.flavor));

  parent reply	other threads:[~2021-11-19 17:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-18 11:40 [Bug fortran/103312] New: ICE in gfc_find_component asolokha at gmx dot com
2021-11-19 10:54 ` [Bug fortran/103312] [9/10/11/12 Regression] ICE in gfc_find_component since r9-1098-g3cf89a7b992d483e marxin at gcc dot gnu.org
2021-11-19 17:15 ` kargl at gcc dot gnu.org [this message]
2022-01-17  9:01 ` rguenth at gcc dot gnu.org
2022-05-27  9:46 ` [Bug fortran/103312] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:46 ` jakub at gcc dot gnu.org
2023-07-07 10:41 ` [Bug fortran/103312] [11/12/13/14 " rguenth at gcc dot gnu.org
2024-04-17  7:10 ` pault at gcc dot gnu.org
2024-05-18  8:03 ` [Bug fortran/103312] [11/12/13/14/15 " pault at gcc dot gnu.org
2024-05-18  8:05 ` pault at gcc dot gnu.org
2024-05-18  8:09 ` pault at gcc dot gnu.org
2024-05-23  7:00 ` cvs-commit at gcc dot gnu.org

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=bug-103312-4-GZkhF60KtG@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).