From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E1EDF3858D39; Mon, 3 Apr 2023 20:16:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E1EDF3858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680552980; bh=Co8cRLnw/d6znjOZZLFZzht/krooLT3q+D1URxX7LEs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=JUbcpZeuqwVDaP3LLZmEe23mclXTtDK3fznnIadKlzAzS+9vbBDheNtX+ZC9wal6B TM2DHZqIKW6HWfaFDZvjZ+PiaoR/03hMvuWhRlo/99OphDG1pDj2xwfY4hP8znvkV9 YOgoI+kCaOt6btnxkUMuEWOQ1Flwls/3S/eah2t4= From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/100607] ICE with SELECT RANK Date: Mon, 03 Apr 2023 20:16:20 +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: 12.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: anlauf 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: bug_status cc keywords 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100607 anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |NEW CC| |anlauf at gcc dot gnu.org Keywords| |diagnostic --- Comment #3 from anlauf at gcc dot gnu.org --- (In reply to kargl from comment #2) > Remove ice-on-invalid-code as I don't get an ICE. >=20 > The following patch suppresses the error message with the temporary varia= ble > and removes duplicated code. Please commit. >=20 > diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc > index 46585879ddc..3462d43f346 100644 > --- a/gcc/fortran/resolve.cc > +++ b/gcc/fortran/resolve.cc > @@ -9909,11 +9909,6 @@ resolve_select_rank (gfc_code *code, gfc_namespace > *old_ns) > || gfc_expr_attr (code->expr1).pointer)) > gfc_error ("RANK (*) at %L cannot be used with the pointer or " > "allocatable selector at %L", &c->where, &code->expr1->where); > - > - if (case_value =3D=3D -1 && (gfc_expr_attr (code->expr1).allocatab= le > - || gfc_expr_attr (code->expr1).pointer)) > - gfc_error ("RANK (*) at %L cannot be used with the pointer or " > - "allocatable selector at %L", &c->where, &code->expr1->where); > } >=20=20 > /* Add EXEC_SELECT to switch on rank. */ This is a gem: not dead code, but un-dead code ... ;-) > @@ -12948,7 +12943,9 @@ resolve_fl_var_and_proc (gfc_symbol *sym, int > mp_flag) >=20=20 > if (allocatable) > { > - if (dimension && as->type !=3D AS_ASSUMED_RANK) > + if (dimension > + && as->type !=3D AS_ASSUMED_RANK > + && !sym->attr.select_rank_temporary) > { > gfc_error ("Allocatable array %qs at %L must have a deferred " > "shape or assumed rank", sym->name, &sym->declared_at); I remember that spot of code as it was hit by one of Gerhard's testcases with as =3D=3D NULL ... I'll have a look. The diagnostic indeed was bogus.=