This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

Re: [Patch, fortran] PR54286 - [4.8 Regression] Accepts invalid proc-pointer assignments involving proc-ptr function result


Hi Paul,

> It is something of an exaggeration to say that this PR is a regession,
> although it is true that gcc-4.7 gives error messages for the testcase
> in the correct places.  In fact, these messages disappear if IMPLICIT
> INTEGER (a) at the start of the testcase.
>
> The fix ensures that the interfaces are selected and checked
> symmetrically in gfc_compare_interfaces.
>
> The submitted testcase only checks the errors.  The other tests in the
> testsuite adequately check the functionality of procedure pointer
> assignments.
>
> Bootstrapped and regtested on FC17/i86_64 - OK for trunk

thanks for the patch. It looks mostly good to me.

Just one question: Why is the symmetrization actually needed? I.e. in
what respect is 'gfc_compare_interfaces' asymmetric? I don't directly
see that. To the contrary, it seems to me that gfc_compare_interfaces
is (at least in parts) already symmetrized internally, as e.g. in:

      if (count_types_test (f1, f2, p1, p2)
      || count_types_test (f2, f1, p2, p1))
    return 0;
      if (generic_correspondence (f1, f2, p1, p2)
      || generic_correspondence (f2, f1, p2, p1))
    return 0;

Also, note that gfc_compare_interfaces is never really called in a
symmetrized fashion elsewhere. Would we need this symmetrization in
other places too?

Cheers,
Janus



> 2013-01-12  Paul Thomas  <pault@gcc.gnu.org>
>
>     PR fortran/54286
>     * expr.c (gfc_check_pointer_assign): Ensure that both lvalue
>     and rvalue interfaces are presented to gfc_compare_interfaces.
>     Simplify references to interface names by using the symbols
>     themselves. Call gfc_compare_interfaces with s1 and s2 inter-
>     changed to overcome the asymmetry of this function. Do not
>     repeat the check for the presence of s1 and s2.
>
> 2013-01-12  Paul Thomas  <pault@gcc.gnu.org>
>
>     PR fortran/54286
>     * gfortran.dg/proc_ptr_result_8.f90 : New test.


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