From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13050 invoked by alias); 20 Jun 2009 17:44:31 -0000 Received: (qmail 12974 invoked by uid 48); 20 Jun 2009 17:44:19 -0000 Date: Sat, 20 Jun 2009 17:44:00 -0000 Message-ID: <20090620174419.12973.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/39850] Too strict checking for procedures as actual argument In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "burnus at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-06/txt/msg01456.txt.bz2 ------- Comment #4 from burnus at gcc dot gnu dot org 2009-06-20 17:44 ------- Regarding comment 0: I believe the program is valid Regarding proc_decl_8.f90 and interface_21.f90: The programs are obviously invalid - and the error message is OK. * * * In case of proc_decl_8.f90/interface_21.f90: The actual argument "foo" can only be a SUBROUTINE as "IMPLICIT NONE; external foo" has been used, but the dummy argument requires a FUNCTION. That violates (12.4.1.3): "If the interface of the dummy argument is explicit, the characteristics listed in 12.2 shall be the same for the associated actual argument" as 12.2 has "The characteristics of a procedure are the classification of the procedure as a function or subroutine" * * * In case of comment 0: The dummy argument is a function (with an implicit interface) and the actual argument is a procedure (with an implicit interface), which can _either_ be a subroutine _or_ an implicitly as real typed function. If the actual procedure is a function, this fulfilled and the program is valid. (As the call makes clear that "func" is a function, a subsequent use of "func" as subroutine is invalid.) * * * For completeness: Passing an actual argument with an implicitly defined interface to a procedure with has an explicit interface: That is valid as long a) as the standard does not mandate the use of an explicit interface b) and the procedure which is associated with the dummy argument has an interface which is conform with the dummy. [One has to be careful whether "actual argument" refers to the entity in the procedure reference or the entity that is associated with the dummy argument. They can be split as in the following case: When the dummy is not a pointer: Here, the entity used in the procedure reference can be a pointer, but the entity associated with the dummy is then not the pointer but the target of the pointer (cf. p.473 in The Fortran 2003 Handbook). Something related applies here: The entity associated with the dummy argument needs to have a conforming interface, but the entity used in the procedure reference can have an implicit interface.] -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39850