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

            Bug ID: 117434
           Summary: [F08] gfortran rejects actual argument corresponding
                    to procedure pointer dummy argument
           Product: gcc
           Version: 14.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: damian at archaeologic dot codes
  Target Milestone: ---

The Fortran 2023 interpretation document clause 15.5.2.10 paragraph 5 allows a
dummy argument procedure pointer to have a corresponding actual argument that
is a valid target for the dummy pointer in a pointer assignment statement.  I
believe this feature first appeared in the 2008 standard.) Gfortran rejects
this feature, which is used ubiquitously through the test suite for the
recently released Julienne unit testing framework (https://go.lbl.gov/julienne)
and this is also used ubiquitously in any software that uses Julienne for unit
testing. 


% cat gfortran-reproducer.f90 

module julienne_test_description_m
  implicit none

  abstract interface
    logical function test_function_i()
    end function
  end interface

  type test_description_t
    procedure(test_function_i), pointer, nopass :: test_function_
  end type

contains

  type(test_description_t) function new_test_description(test_function)
    procedure(test_function_i), intent(in), pointer :: test_function
    new_test_description%test_function_ => test_function
  end function

end module

  use julienne_test_description_m
  implicit none
  type(test_description_t) test_description

  test_description = new_test_description(test)

contains

  logical function test()
    test = .true.
  end function

end

% gfortran gfortran-reproducer.f90 
gfortran-reproducer.f90:26:42:

   26 |   test_description = new_test_description(test)
      |                                          1
Error: Expected a procedure pointer for argument 'test_function' at (1)

% gfortran --version
GNU Fortran (Homebrew GCC 14.2.0) 14.2.0

Reply via email to