This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, fortran] PR54286 - [4.8 Regression] Accepts invalid proc-pointer assignments involving proc-ptr function result
Dear Janus (and Dominique),
Thanks for the review. I found that the symmetrization is necessary
experimentally :-) I did not think anything of it, since I have
encountered such asymmetries elsewhere in interface.c. When I have a
quiet moment, I'll try to understand why this is necessary for this
patch.
Committed as r195133.
Overnight, class_optional_2.f90 started failing at -Os. I double
checked that this patch did not cause the regression. If somebody
else does not beat me to it, I'll investigate tonight.
Cheers
Paul
On 12 January 2013 20:35, Janus Weil <janus@gcc.gnu.org> wrote:
> 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.
--
The knack of flying is learning how to throw yourself at the ground and miss.
--Hitchhikers Guide to the Galaxy