From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31056 invoked by alias); 5 Apr 2008 08:33:37 -0000 Received: (qmail 30900 invoked by uid 48); 5 Apr 2008 08:32:52 -0000 Date: Sat, 05 Apr 2008 08:33:00 -0000 Subject: [Bug fortran/35831] New: Type-mismatch check missing for dummy procedure argument X-Bugzilla-Reason: CC Message-ID: 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: 2008-04/txt/msg00409.txt.bz2 In the following program, the interface of the dummy procedure is explicit. Fortran 2003's "12.4.1.3 Actual arguments associated with dummy procedure entities" has about this: "If the interface of the dummy argument is explicit, the characteristics listed in 12.2 shall be the same for the associated actual argument and the corresponding dummy argument, except that a pure actual argument may be associated with a dummy argument that is not pure and an elemental intrinsic actual procedure may be associated with a dummy procedure (which is prohibited from being elemental)." "If an external procedure name or a dummy procedure name is used as an actual argument, its interface shall be explicit or it shall be explicitly declared to have the EXTERNAL attribute." gfortran does not seem to check whether the array arguments of dummy procedures match. One reason could be that passing a "a(2)" array ("call foo(a)") to an array "a(:)" is valid, but this does not apply here. For some reason, gfortran checks this for PROCEDURE() :: dummy but not for INTERFACE; subroutine dummy() ... in principle I had expected that both is handled identically. Remove the "!!" to test the PROCEDURE version. Found at http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/330df81363912681 Please also check the version given there (incl. the PROCEDURE version) when fixing this PR. program test implicit none interface subroutine one(a) integer a(:) end subroutine one subroutine two(a) integer a(2) end subroutine two end interface ! PROCEDURE dummy, gives error: !! call foo(two) ! OK: "Type/rank mismatch in argument 'f'" ! Interface dummy, is accepted: call bar(two) ! Invalid, not diagnosed contains ! Valid, but gives an ICE in trans-*.c, see PR 35830 !! subroutine foo(f) !! procedure(one) :: f !! end subroutine foo subroutine bar(f) interface subroutine f(a) integer a(:) end subroutine f end interface end subroutine bar end program test -- Summary: Type-mismatch check missing for dummy procedure argument Product: gcc Version: 4.4.0 Status: UNCONFIRMED Keywords: accepts-invalid Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: burnus at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35831