public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "anlauf at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/104351] ICE in gfc_generate_initializer, at fortran/expr.cc:5140
Date: Tue, 10 Oct 2023 21:02:25 +0000	[thread overview]
Message-ID: <bug-104351-4-p1ZOropK2g@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-104351-4@http.gcc.gnu.org/bugzilla/>

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
                 CC|                            |anlauf at gcc dot gnu.org
   Last reconfirmed|                            |2023-10-10
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from anlauf at gcc dot gnu.org ---
The following untested, semi-obvious patch fixes the ICE:

diff --git a/gcc/fortran/decl.cc b/gcc/fortran/decl.cc
index 4a3c5b86de0..892e3788b9d 100644
--- a/gcc/fortran/decl.cc
+++ b/gcc/fortran/decl.cc
@@ -1404,7 +1421,9 @@ get_proc_name (const char *name, gfc_symbol **result,
bool module_fcn_entry)
       /* Trap declarations of attributes in encompassing scope.  The
         signature for this is that ts.kind is nonzero for no-CLASS
         entity.  For a CLASS entity, ts.kind is zero.  */
-      if ((sym->ts.kind != 0 || sym->ts.type == BT_CLASS)
+      if ((sym->ts.kind != 0
+          || sym->ts.type == BT_CLASS
+          || sym->ts.type == BT_DERIVED)
          && !sym->attr.implicit_type
          && sym->attr.proc == 0
          && gfc_current_ns->parent != NULL
@@ -7622,6 +7641,10 @@ gfc_match_function_decl (void)
           if (current_ts.type != BT_UNKNOWN
              && !gfc_add_type (result, &current_ts, &gfc_current_locus))
            goto cleanup;
+         if (current_ts.type != BT_UNKNOWN
+             && sym->ts.type != BT_UNKNOWN
+             && sym->ts.type != current_ts.type)
+           goto cleanup;
          sym->result = result;
        }

  parent reply	other threads:[~2023-10-10 21:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-02 18:45 [Bug fortran/104351] New: " gscfq@t-online.de
2022-02-02 18:45 ` [Bug fortran/104351] " gscfq@t-online.de
2023-10-10 21:02 ` anlauf at gcc dot gnu.org [this message]
2023-10-11 19:41 ` anlauf at gcc dot gnu.org
2023-10-13 20:08 ` cvs-commit at gcc dot gnu.org
2023-10-14 20:02 ` anlauf 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-104351-4-p1ZOropK2g@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).