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

            Bug ID: 120371
           Summary: [15.1 regression] erroneously triggered error message
                    on non-matching interfaces with flag -Wall
           Product: gcc
           Version: 15.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: juergen.reuter at desy dot de
  Target Milestone: ---

Created attachment 61483
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61483&action=edit
Reproducer

The following code when compiled with -Wall is rejected with erroneous error
messages:
Error: Interface mismatch in dummy procedure ‘evaluate_special’ at (1):
'evaluate_special' has the wrong number of arguments
The -Wall doesn't produce this error message for versions 11.5, 13.3 or 14.2,
but with 15.1.

The reproducer is listed below and attached:

module lorentz
  implicit none
  private
  type :: vector4_t
     real, dimension(0:3) :: p = [0, 0, 0, 0]
  end type vector4_t

  abstract interface
     subroutine func_spec (p_origin, &
          p1_in, p1_out, msq_in, jac)
       import
       type(vector4_t), intent(in) :: p_origin
       type(vector4_t), intent(in) :: p1_in
       type(vector4_t), intent(inout) :: p1_out
       real, intent(in), optional :: msq_in
       real, intent(inout), optional :: jac
     end subroutine func_spec
  end interface

contains

  recursive subroutine rec_func (p_dec, &
      p_in, p_out, i_real, msq_in, jac, evaluate_special)
    type(vector4_t), intent(in) :: p_dec
    type(vector4_t), intent(in), dimension(:) :: p_in
    type(vector4_t), intent(inout), dimension(:) :: p_out
    integer, intent(in) :: i_real
    real, intent(in), optional :: msq_in
    real, intent(inout), optional :: jac
    procedure(func_spec), intent(in), &
          pointer, optional :: evaluate_special
    type(vector4_t) :: p_dec_new
    if (present (evaluate_special)) then
       call evaluate_special (p_in(1), p_in(2), &
            p_out(i_real))
       call rec_func (p_in(1), p_in (2 : ), p_out, &
            i_real + 1, msq_in, jac, evaluate_special)
    else
       call func (p_in(1), p_in(2), &
            p_out(i_real), msq_in, jac)
    end if

  end subroutine rec_func

  subroutine func (p_origin, &
      p1_in, p1_out, msq_in, jac)
    type(vector4_t), intent(in) :: p_origin
    type(vector4_t), intent(in) :: p1_in
    type(vector4_t), intent(inout) :: p1_out
    real, intent(in), optional :: msq_in
    real, intent(inout), optional :: jac
    type(vector4_t) :: p1_rest, p2_rest
    real :: msq_in_update
    p1_rest = p1_in
    p1_out = p1_rest 
    msq_in_update = 42.
    if (present (jac) .and. present (msq_in)) then
       jac = jac * msq_in_update
    end if
  end subroutine func

end module lorentz

Reply via email to