Hi, the attached code compiles with ifort 11.1 and with nagfor 5.2, but is rejected with current gfortran: gfcbug93.f90:47.12: print *, ipmin% dot_g_g (g,g) 1 Error: ABSTRACT INTERFACE 'dot' must not be referenced at (1) gfcbug93.f90:47.12: print *, ipmin% dot_g_g (g,g) 1 Error: ABSTRACT INTERFACE 'dot' must not be referenced at (1) Cheers, -ha
Created attachment 18931 [details] Test code
I agree that the following error is bogus: > print *, ipmin% dot_g_g (g,g) > 1 > Error: ABSTRACT INTERFACE 'dot' must not be referenced at (1) While one might not access (type)%dot_g_g as "dot_g_g" is deferred, using (class)%dot_g_g is valid. (And using (type)%dot_g_g is not possible as one cannot use "type(abstract_t)"; thus it might be enough to relax the check.)
(In reply to comment #0) > Error: ABSTRACT INTERFACE 'dot' must not be referenced at (1) The same error appears in PR 41556.
Reduced test case: implicit none type, abstract :: inner_product_class contains procedure(dot), public, nopass, deferred :: dot_g_g end type abstract interface real function dot () end function end interface contains subroutine cg (ipmin) class(inner_product_class) :: ipmin print *, ipmin%dot_g_g () end subroutine end Triggers the same error message as comment #0, which, in addition to being bogus, appears twice.
(In reply to comment #2) > While one might not access (type)%dot_g_g as "dot_g_g" is deferred, using > (class)%dot_g_g is valid. (And using (type)%dot_g_g is not possible as one > cannot use "type(abstract_t)"; thus it might be enough to relax the check.) It might be okay for type-bound procedures. However, this check should also catch the usage of simple abstract procedures, i.e. when adding the following to the test case in comment #4: print *, dot() This is illegal of course, and is not caught without the check in resolve_function.
Subject: Bug 41873 Author: janus Date: Thu Nov 5 10:42:48 2009 New Revision: 153934 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=153934 Log: 2009-11-05 Janus Weil <janus@gcc.gnu.org> PR fortran/41556 PR fortran/41873 * resolve.c (resolve_function,resolve_call): Prevent abstract interfaces from being called, but allow deferred type-bound procedures with abstract interface. 2009-11-05 Janus Weil <janus@gcc.gnu.org> PR fortran/41556 PR fortran/41873 * gfortran.dg/interface_abstract_4.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/interface_abstract_4.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/resolve.c trunk/gcc/testsuite/ChangeLog
Fixed with r153934. Closing.