[Patch, Fortran, OOP] PR 56261: seg fault call procedure pointer on polymorphic array

Janus Weil janus@gcc.gnu.org
Sun Apr 7 20:03:00 GMT 2013


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr56261_v2.diff
Type: application/octet-stream
Size: 3084 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130407/86e7ffad/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: proc_ptr_40.f90
Type: application/octet-stream
Size: 444 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130407/86e7ffad/attachment-0001.obj>


More information about the Gcc-patches mailing list