From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0D87E386187E; Sun, 20 Sep 2020 03:26:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0D87E386187E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1600572367; bh=omxwheNE5M9IXTjaGNejxsgMpKPFGYtnH1qffKdU+mk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=AnVG4GIav2Kx3JqwdDKIVP0l5WdVoZwWMiz9lJ6Jwu8S3Juk3olV48x3JSnqIcPt0 WQ66QzL5A4ZbD6mstMC01Ny/BpiEBIE/Z1UcTbBrbTzUYQFxhyfxPnFIsw71cXzK2o peLOm+O7xew4qveFps1VsbbXgZJFzCdIy3vzS/Rs= From: "kargl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/97122] Spurious FINAL ... must be in the specification part of a MODULE Date: Sun, 20 Sep 2020 03:26:06 +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: 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: cf_reconfirmed_on everconfirmed cc priority bug_status 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: Sun, 20 Sep 2020 03:26:07 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97122 kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2020-09-20 Ever confirmed|0 |1 CC| |kargl at gcc dot gnu.org Priority|P3 |P4 Status|UNCONFIRMED |NEW --- Comment #1 from kargl at gcc dot gnu.org --- This allows your code to compile. Index: gcc/fortran/decl.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/decl.c (revision 280157) +++ gcc/fortran/decl.c (working copy) @@ -11395,8 +11395,9 @@ gfc_match_final_decl (void) block =3D gfc_state_stack->previous->sym; gcc_assert (block); - if (!gfc_state_stack->previous || !gfc_state_stack->previous->previous - || gfc_state_stack->previous->previous->state !=3D COMP_MODULE) + if (!gfc_state_stack->previous->previous + && gfc_state_stack->previous->previous->state !=3D COMP_MODULE + && gfc_state_stack->previous->previous->state !=3D COMP_SUBMODULE) { gfc_error ("Derived type declaration with FINAL at %C must be in the" " specification part of a MODULE"); Alternatively, the if-block can likely be removed.=