The following valid program is rejected. The problem is that gfortran assigns the interface of the INTRINSIC function "cos" to "f" and not the one of the abstract interface. If one uses "interface" instead of "abstract interface" it works. abstract interface function dim() integer :: dim end function dim end interface procedure(dim) :: f print *, f() end
> The problem is that gfortran assigns the interface > of the INTRINSIC function "cos" to "f" You surely mean the intrinsic function DIM ;) > If one uses "interface" instead of "abstract interface" it works. No, for me it actually doesn't make a difference. In particular the following is also rejected: interface integer function dim() end function end interface procedure(dim) :: f print *, dim() end Without the PROCEDURE line it works fine.
This patch fixes both of the test cases in comment #0 and comment#1: Index: gcc/fortran/decl.c =================================================================== --- gcc/fortran/decl.c (revision 136533) +++ gcc/fortran/decl.c (working copy) @@ -4085,8 +4085,10 @@ match_procedure_decl (void) return MATCH_ERROR; } /* Handle intrinsic procedures. */ - if (gfc_intrinsic_name (proc_if->name, 0) - || gfc_intrinsic_name (proc_if->name, 1)) + if (!(proc_if->attr.external || proc_if->attr.use_assoc + || proc_if->attr.if_source == IFSRC_IFBODY) + && (gfc_intrinsic_name (proc_if->name, 0) + || gfc_intrinsic_name (proc_if->name, 1))) proc_if->attr.intrinsic = 1; if (proc_if->attr.intrinsic && !gfc_intrinsic_actual_ok (proc_if->name, 0)) This is the same check that's done in resolve.c (resolve_actual_arglist) for dummy procedures.
> This is the same check that's done in resolve.c (resolve_actual_arglist) for > dummy procedures. Thanks for the quick patch. (Do you think my patch for PR35830 is OK? Off topic: I'd really like to see proc pointers being checked in; one can still work afterwards on related PRs such as PR36322 or loosely related PRs PR35831 and PR36426.)
Subject: Bug 36459 Author: janus Date: Sun Jun 8 11:55:41 2008 New Revision: 136555 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=136555 Log: 2008-06-08 Janus Weil <janus@gcc.gnu.org> PR fortran/36459 * decl.c (match_procedure_decl): Correctly recognize if the interface is an intrinsic procedure. 2008-06-08 Janus Weil <janus@gcc.gnu.org> PR fortran/36459 * gfortran.dg/proc_decl_16.f90: New. Added: trunk/gcc/testsuite/gfortran.dg/proc_decl_16.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/decl.c trunk/gcc/testsuite/ChangeLog
Fixed in rev 136555. Closing.