From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 303373857024; Tue, 30 Jun 2020 21:41:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 303373857024 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1593553284; bh=VLneDcUH2E8PDWDpm8fC4lRLWtMP0AKAF8RO76k6AQY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=k0D4GNfo56+K8WiiL+B/8qbl0x2383pPw19gak5QN7Y4cPLlCh0Jl8Y1AQeKd/RS/ 6bu63mUS2jX9TmVMPTeLWd1CHMa+agfY7MQpxKhC+Rri+Sm/En7j9PuR/2H5IDBIg0 R/u1GSucdOpWk2J6MxuwdSsw/xWFWN30TlThOQ3E= 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:41:24 +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:41:24 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96013 --- Comment #6 from kargl at gcc dot gnu.org --- With this patch the code compiles: 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) @@ -5737,8 +5737,13 @@ write_symbol (int n, gfc_symbol *sym) { const char *label; - if (sym->attr.flavor =3D=3D FL_UNKNOWN || sym->attr.flavor =3D=3D FL_LAB= EL) - gfc_internal_error ("write_symbol(): bad module symbol %qs", sym->name= ); + if ((sym->attr.flavor =3D=3D FL_UNKNOWN || sym->attr.flavor =3D=3D FL_LA= BEL) + && !(sym->ts.type !=3D BT_UNKNOWN && sym->attr.result)) + { + gfc_error ("Invalid symbol %qs at %L", sym->name, + &sym->declared_at); + return; + } mio_integer (&n); As far as setting 't', one can get a warning with -Wall. gfcx -Wall -c a.f90 a.f90:5:25: 5 | function f() result(t) | 1 Warning: Return value 't' of function 'f' declared at (1) not set [-Wreturn-typ] Not sure why this isn't an error (perhaps, false-positives?).=