This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/68534] No error on mismatch in number of arguments between submodule and module interface


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68534

--- Comment #2 from Paul Thomas <pault at gcc dot gnu.org> ---
Created attachment 36836
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36836&action=edit
Draft patch for the PR

The attached bootstraps and regtests OK on a tree heavily polluted by the
recursive allocatable component patch. I had to break this chunk out be hand
and so the patch might not apply cleanly. I'll do a proper job tonight.

Neither case of no dummies matching a finite number works correctly: neither
none in the interface nor none in the procedure declaration.

! { dg-do compile }
!
! Checks the fix for PR68534 in which checks for the number
! failed if either the interface or the module procedure had
! no dummies.
!
! Reported on clf at:
! https://groups.google.com/forum/#!topic/comp.lang.fortran/-ZgbM5qkFmc
!
module m
  implicit none
    interface
      module subroutine foo()
      end subroutine foo

      module subroutine bar(i)
        integer, intent(inout) :: i
      end subroutine bar
   end interface
end module m

submodule(m) sm
contains
  module subroutine foo(i) ! { dg-error "without matching arguments in
INTERFACE" }
    integer, intent(inout) :: i
    i = 42
  end subroutine foo

  module subroutine bar ! { dg-error "Mismatch in number of MODULE PROCEDURE
formal" }
    print *, "bar"
  end subroutine bar
end submodule sm

Annoyingly, the second test fails. Although the message is omitted, for some
reason the current locus is lost.

Paul

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]