From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 26BFB388A833; Tue, 30 Jun 2020 21:22:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 26BFB388A833 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1593552126; bh=cAYWlAw8iTRP0cZXTL/RUSsfPSPFri+1xWue6qUFBAQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=uTocQahpNchpXrxLouOIGF11pG33Iafbw+nYKRRtwejqDIpcJXy2+gwkRdwCb0GZd T7z9I16OL1AATuLAsMQTB2HVN/d3GZGaR749xnaQmE44KJagq3wdRsr/Is3sHGJgH3 oEo9tm4FgAqrut/h4vfja0Oqde7NkWlBWQzjDtZk= From: "kargl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/96013] ICE in write_symbol, at fortran/module.c:5747 Date: Tue, 30 Jun 2020 21:22:05 +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-invalid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: kargl 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 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: Tue, 30 Jun 2020 21:22:06 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96013 --- Comment #4 from kargl at gcc dot gnu.org --- (In reply to kargl from comment #3) > The code is invalid. Patch against svn revision 280156. >=20 > Index: gcc/fortran/module.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- gcc/fortran/module.c (revision 280157) > +++ gcc/fortran/module.c (working copy) > @@ -5738,7 +5738,11 @@ write_symbol (int n, gfc_symbol *sym) > const char *label; >=20=20 > if (sym->attr.flavor =3D=3D FL_UNKNOWN || sym->attr.flavor =3D=3D FL_L= ABEL) > - gfc_internal_error ("write_symbol(): bad module symbol %qs", sym->na= me); > + { > + gfc_error ("Invalid symbol %qs at %L", sym->name, > + &sym->declared_at); > + return; > + } >=20=20 > mio_integer (&n); The patch is wrong and Gerhard is sort of correct. z1.f90 is invalid as the result variable is never set. But, an internal error should not be signaled. Fortran 2018 has 19.5.1.4 Host association A name that appears in the scoping unit as ... (12) a result-name in a function-stmt or in an entry-stmt, ... is a local identifier in the scoping unit and any entity of the host that has this as its nongeneric name is inaccessible by that name by host association. So, the type 't' is inaccessible in the local scope of f(). The code is a good example for the requirement of 'implicit none'.=