public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/35831]  New: Type-mismatch check missing for dummy procedure argument
@ 2008-04-05  8:33 burnus at gcc dot gnu dot org
  2008-04-08 20:59 ` [Bug fortran/35831] " jaydub66 at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 20+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-04-05  8:33 UTC (permalink / raw)
  To: gcc-bugs

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(<interface>) :: 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


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2013-12-10 21:53 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-35831-4@http.gcc.gnu.org/bugzilla/>
2011-09-10 11:24 ` [Bug fortran/35831] Type-mismatch check missing for dummy procedure argument janus at gcc dot gnu.org
2011-09-10 11:27 ` [Bug fortran/35831] [F95] Shape mismatch " janus at gcc dot gnu.org
2011-09-10 11:31 ` janus at gcc dot gnu.org
2011-09-11 10:09 ` janus at gcc dot gnu.org
2011-09-11 20:13 ` janus at gcc dot gnu.org
2011-09-11 20:50 ` janus at gcc dot gnu.org
2011-09-29 16:51 ` janus at gcc dot gnu.org
2011-10-03 19:53 ` janus at gcc dot gnu.org
2011-10-04 18:39 ` janus at gcc dot gnu.org
2011-10-04 18:53 ` janus at gcc dot gnu.org
2011-10-05 20:07 ` janus at gcc dot gnu.org
2012-08-06 20:36 ` janus at gcc dot gnu.org
2012-08-06 21:03 ` janus at gcc dot gnu.org
2013-12-10 21:41 ` janus at gcc dot gnu.org
2013-12-10 21:53 ` janus at gcc dot gnu.org
2008-04-05  8:33 [Bug fortran/35831] New: Type-mismatch " burnus at gcc dot gnu dot org
2008-04-08 20:59 ` [Bug fortran/35831] " jaydub66 at gmail dot com
2008-04-09 18:24 ` jaydub66 at gmail dot com
2008-04-09 18:50 ` burnus at gcc dot gnu dot org
2008-04-10 21:10 ` jaydub66 at gmail dot com
2008-04-11  7:46 ` burnus at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).