[Bug fortran/56823] New: Problem with: interface block dummy argument + procedure pointer actual argument
mrestelli at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Apr 3 07:23:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56823
Bug #: 56823
Summary: Problem with: interface block dummy argument +
procedure pointer actual argument
Classification: Unclassified
Product: gcc
Version: fortran-dev
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: mrestelli@gmail.com
The attached code produces an error with gfortran:
gfortran pp.f90 -o pp
pp.f90:39.11:
call sub(f)
1
Error: Interface mismatch in dummy procedure 'fun' at (1): PROCEDURE POINTER
mismatch in function result
The code however should be fine (ifort accepts it). This has lso been
discussed in
http://groups.google.com/groups?selm=kjeu4o$e6o$1@dont-email.me
gfortran --version
GNU Fortran (GCC) 4.9.0 20130402 (experimental)
module m1
abstract interface
pure function i_f(x) result(d)
real, intent(in) :: x(:,:)
real :: d(size(x,1),size(x,2))
end function i_f
end interface
procedure(i_f), pointer :: f => null()
contains
pure function this_is_a_function(x) result(d)
real, intent(in) :: x(:,:)
real :: d(size(x,1),size(x,2))
end function this_is_a_function
end module m1
module m2
contains
pure subroutine sub(fun)
! Using i_f the code works
!use m1
!procedure(i_f) :: fun
! Using an interface however it does not work
interface
pure function fun(x) result(d)
real, intent(in) :: x(:,:)
real :: d(size(x,1),size(x,2))
end function fun
end interface
end subroutine sub
end module m2
program p
use m1
use m2
f => this_is_a_function
call sub(f)
end program p
More information about the Gcc-bugs
mailing list