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, OOP] PR 56261: seg fault call procedure pointer on polymorphic array


Hi all,

here is a patch for an accepts-invalid problem: The Fortran standard
demands that a procedure with a polymorphic dummy arguments can only
be referenced with an explicit interface (see F08:12.4.2.2).

It is nontrivial to detect this in every case (e.g. passing a TYPE
actual to a CLASS formal arg), but at least we can easily detect it if
a polymorphic *actual* argument is involved (which means that the
corresponding formal arg must also be polymorphic).

The patch adds a check for this, and it also restricts the check we
already have for global procedures (in order to avoid double
diagnostics for these).

Regtested on x86_64-unknown-linux-gnu. Ok for trunk?

Cheers,
Janus


2013-04-07  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/56261
    * interface.c (gfc_procedure_use): Error on polymorphic actual arguments
    passed to implicit interface.
    * resolve.c (resolve_global_procedure): Don't error on polymorphic
    actual arguments passed to implicit interface (to avoid double
    diagnostics).


2013-04-07  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/56261
    * gfortran.dg/abstract_type_6.f03: Add dg-error.
    * gfortran.dg/whole_file_20.f03: Check one additional case (and modified
    error for another).
    * gfortran.dg/proc_ptr_40.f90: New.

Attachment: pr56261_v2.diff
Description: Binary data

Attachment: proc_ptr_40.f90
Description: Binary data


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