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/99139] ICE: gfc_get_default_type(): Bad symbol '__tmp_UNKNOWN_0_rank_1'
Date: Wed, 17 Feb 2021 19:49:41 +0000	[thread overview]
Message-ID: <bug-99139-4-iEi4vraSwS@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99139-4@http.gcc.gnu.org/bugzilla/>

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org
   Last reconfirmed|                            |2021-02-17
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
           Priority|P3                          |P4

--- Comment #2 from kargl at gcc dot gnu.org ---
Fixes problem with original code.  Not regression tested.

diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index 2df6191d7e6..eb51b9905da 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -6634,6 +6639,18 @@ gfc_match_select_rank (void)

   gfc_current_ns = gfc_build_block_ns (ns);
   m = gfc_match (" %n => %e", name, &expr2);
+
+  /* If expr2 corresponds to an implicitly typed variable, then the actual
+     type of the variable may not have been resolved.  Set it here.  */
+  if (!gfc_current_ns->seen_implicit_none
+      && expr2->expr_type == EXPR_VARIABLE
+      && expr2->ts.type == BT_UNKNOWN
+      && expr2->symtree && expr2->symtree->n.sym)
+    {
+      gfc_set_default_type (expr2->symtree->n.sym, 0, gfc_current_ns);
+      expr2->ts.type = expr2->symtree->n.sym->ts.type;
+    }
+    
   if (m == MATCH_YES)
     {
       expr1 = gfc_get_expr ();

  parent reply	other threads:[~2021-02-17 19:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-17 18:12 [Bug fortran/99139] New: " gscfq@t-online.de
2021-02-17 18:13 ` [Bug fortran/99139] " gscfq@t-online.de
2021-02-17 19:49 ` kargl at gcc dot gnu.org [this message]
2021-02-18  8:42 ` marxin at gcc dot gnu.org
2021-10-24  5:51 ` sandra at gcc dot gnu.org
2023-05-28 15:29 ` kargl at gcc dot gnu.org
2023-07-08 17:13 ` cvs-commit at gcc dot gnu.org
2023-07-14 18:54 ` anlauf at gcc dot gnu.org
2023-07-15  6:15 ` pault at gcc dot gnu.org
2023-07-15  7:50 ` sgk at troutmask dot apl.washington.edu

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-99139-4-iEi4vraSwS@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).