From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 040B93858D28; Wed, 25 Jan 2023 21:41:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 040B93858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674682881; bh=G3Dg86SQeZcOdrtNcm1C03d+uC09IZ7VyCn1RyO75vc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=g84HGz7Hf5x8eD6rPZYOs6o3YUeklBs46bIzJVEMl9EvBVuPvJK9K3pwU4EyAxAtJ fdNXuXjltv5HSzIAU7rbuKfg6YSvyI89Pcnk4oI5e7PXTR8dHBThvF7RXjVjlPEJzn kvcE4UNBNRhC564E0aRTg+mFnUui3POC8tGHZNEw= From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/108544] ICE in check_host_association, at fortran/resolve.cc:6135 Date: Wed, 25 Jan 2023 21:41: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: 13.0 X-Bugzilla-Keywords: ice-on-invalid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: anlauf at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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=3D108544 --- Comment #2 from anlauf at gcc dot gnu.org --- I played a little and found a variation of testcase pr96102.f90 that was silently accepted but is rejected by Intel, NAG, Cray, NVidia: module m type mytype integer :: i end type type(mytype) :: d =3D mytype (42) ! { dg-error "is host associated" } integer :: n =3D 2 ! { dg-error "is host associated" } contains subroutine s if ( n /=3D 0 ) stop 1 ! { dg-error "internal procedure of the same = name" } if ( d%i /=3D 0 ) stop 2 ! { dg-error "internal procedure of the same = name" } contains subroutine n() end subroutine d() end end end This need removing just one line of code in addition to comment#1: diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc index 94213cd3cd4..b40e04513b5 100644 --- a/gcc/fortran/resolve.cc +++ b/gcc/fortran/resolve.cc @@ -6087,7 +6093,6 @@ check_host_association (gfc_expr *e) gfc_find_symbol (e->symtree->name, gfc_current_ns, 1, &sym); if (sym && old_sym !=3D sym - && sym->ts.type =3D=3D old_sym->ts.type && sym->attr.flavor =3D=3D FL_PROCEDURE && sym->attr.contained) { @@ -6132,6 +6137,9 @@ check_host_association (gfc_expr *e) return false; } + if (ref =3D=3D NULL) + return false; + gcc_assert (ref->type =3D=3D REF_ARRAY); /* Grab the start expressions from the array ref and Am I missing something?=