From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E545A385840C; Thu, 29 Feb 2024 02:15:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E545A385840C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709172956; bh=h0TuzV5S7RzG5wlG3PzDK+qPp2Fw5ySyaqZCnv28izs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=OLKnp0MayZvPbp6t28Lix0AymOVW/t+rwwbO4PHc0EEjS3NxFx25byK16ruOZIXAG dBymOO+cec21/obqgkT8OPq199zwY77CNvFQ0vZrRejXVsO2pvS+sk6tGu9wIRSizC L9CZeCuG/DxnmUpUyiIVQdpu7lcV2SpMfG7rdHvg= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/86148] parameterized type compile time error Date: Thu, 29 Feb 2024 02:15:52 +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: 8.1.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: pault 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=3D86148 --- Comment #7 from GCC Commits --- The master branch has been updated by Alexander Westbrooks alexanderw : https://gcc.gnu.org/g:edfe198084338691d0facc86bf8dfa6ede3ca676 commit r14-9229-gedfe198084338691d0facc86bf8dfa6ede3ca676 Author: Alexander Westbrooks Date: Wed Feb 28 20:03:46 2024 -0600 Fortran - Error compiling PDT Type-bound Procedures [PR82943/86148/8626= 8] This patch allows parameterized derived types to compile successfully when typebound procedures are specified in the type specification. Furthermore, it allows function calls for PDTs by setting the f2k_derived space of PDT instances to reference their original template, thereby giving it referential access to the typebound procedures of the template. Lastly, it adds a check for deferred length parameters of PDTs in CLASS declaration statements, and correctly throws an error if such declarations are missing POINTER or ALLOCATABLE attributes. 2024-02-25 Alexander Westbrooks gcc/fortran/ChangeLog: PR fortran/82943 PR fortran/86148 PR fortran/86268 * decl.cc (gfc_get_pdt_instance): Set the PDT instance field 'f2k_derived', if not set already, to point to the given PDT template 'f2k_derived' namespace in order to give the PDT instance referential access to the typebound procedures of the template. * gfortran.h (gfc_pdt_is_instance_of): Add prototype. * resolve.cc (resolve_typebound_procedure): If the derived type does not have the attribute 'pdt_template' set, compare the dummy argument to the 'resolve_bindings_derived' type like usua= l. If the derived type is a 'pdt_template', then check if the dummy argument is an instance of the PDT template. If the deriv= ed type is a PDT template, and the dummy argument is an instance of that template, but the dummy argument 'param_list' is not SPEC_ASSUMED, check if there are any LEN parameters in the dummy argument. If there are no LEN parameters, then this impli= es that there are only KIND parameters in the dummy argument. If there are LEN parameters, this would be an error, for all LEN parameters for the dummy argument MUST be assumed for typebound procedures of PDTs. (resolve_pdt): Add a check for ALLOCATABLE and POINTER attribut= es for SPEC_DEFERRED parameters of PDT class symbols. ALLOCATABLE and POINTER attributes for a PDT class symbol are stored in the 'class_pointer' and 'allocatable' attributes of the '_data' component respectively. * symbol.cc (gfc_pdt_is_instance_of): New function. gcc/testsuite/ChangeLog: PR fortran/82943 PR fortran/86148 PR fortran/86268 * gfortran.dg/pdt_4.f03: Update modified error message. * gfortran.dg/pdt_34.f03: New test. * gfortran.dg/pdt_35.f03: New test. * gfortran.dg/pdt_36.f03: New test. * gfortran.dg/pdt_37.f03: New test. Signed-off-by: Alexander Westbrooks =