From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 015033857C56; Wed, 17 Feb 2021 19:49:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 015033857C56 From: "kargl at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: kargl at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc cf_reconfirmed_on everconfirmed bug_status priority Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 19:49:42 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99139 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 =3D gfc_build_block_ns (ns); m =3D gfc_match (" %n =3D> %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 =3D=3D EXPR_VARIABLE + && expr2->ts.type =3D=3D BT_UNKNOWN + && expr2->symtree && expr2->symtree->n.sym) + { + gfc_set_default_type (expr2->symtree->n.sym, 0, gfc_current_ns); + expr2->ts.type =3D expr2->symtree->n.sym->ts.type; + } +=20=20=20=20 if (m =3D=3D MATCH_YES) { expr1 =3D gfc_get_expr ();=