This is the mail archive of the gcc-patches@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]

[Patch, Fortran] PR 60507: Passing function call into procedure argument not caught


Hi all,

here is a patch to improve diagnostics for dummy procedures. Regtested
on x86_64-unknown-linux-gnu. Ok for trunk?

Cheers,
Janus



2014-12-29  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/60507
    * interface.c (is_procptr_result): New function to check if an
    expression is a procedure-pointer result.
    (compare_actual_formal): Use it.

2014-12-29  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/60507
    * gfortran.dg/dummy_procedure_11: New.

Attachment: pr60507.diff
Description: Text document

! { dg-do compile }
!
! PR 60507: Passing function call into procedure argument not caught
!
! Contributed by Vladimir Fuka <vladimir.fuka@gmail.com>

type :: t
  procedure(g), pointer, nopass :: ppc => g
end type

procedure(g), pointer :: pp => g
type(t)::x

print *, f(g)
print *, f(g())      ! { dg-error "Expected a procedure for argument" }
print *, f(pp)
print *, f(pp())     ! { dg-error "Expected a procedure for argument" }
print *, f(x%ppc)
print *, f(x%ppc())  ! { dg-error "Expected a procedure for argument" }

contains

  real function f(fun)
    procedure(g) :: fun
    f = fun()
  end function

  real function g()
    g = 1.
  end function

end

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