From: Janus Weil Date: Fri, 20 Sep 2013 07:44:05 +0000 (+0200) Subject: re PR fortran/58099 ([F03] over-zealous procedure-pointer error checking) X-Git-Tag: releases/gcc-4.9.0~3962 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1f46d137d00b0e733bb4ccd75a62a9e57f64abdd;p=thirdparty%2Fgcc.git re PR fortran/58099 ([F03] over-zealous procedure-pointer error checking) 2013-09-20 Janus Weil PR fortran/58099 * expr.c (gfc_check_pointer_assign): Remove second call to 'gfc_compare_interfaces' with swapped arguments. * interface.c (gfc_compare_interfaces): Symmetrize the call to 'check_result_characteristics' by calling it with swapped arguments. 2013-09-20 Janus Weil PR fortran/58099 * gfortran.dg/proc_ptr_43.f90: New. From-SVN: r202766 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index de38d3f00fa5..0e4d688f975d 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2013-09-20 Janus Weil + + PR fortran/58099 + * expr.c (gfc_check_pointer_assign): Remove second call to + 'gfc_compare_interfaces' with swapped arguments. + * interface.c (gfc_compare_interfaces): Symmetrize the call to + 'check_result_characteristics' by calling it with swapped arguments. + 2013-09-18 Tobias Burnus * expr.c (gfc_check_assign_symbol): Free lvalue.ref. diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 666309245f03..b2af32816e5a 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -3581,14 +3581,6 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue) return false; } - if (!gfc_compare_interfaces (s2, s1, name, 0, 1, - err, sizeof(err), NULL, NULL)) - { - gfc_error ("Interface mismatch in procedure pointer assignment " - "at %L: %s", &rvalue->where, err); - return false; - } - return true; } diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index aa88b3c3fa67..b8786440fbec 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -1416,7 +1416,8 @@ gfc_compare_interfaces (gfc_symbol *s1, gfc_symbol *s2, const char *name2, if (s1->attr.function && s2->attr.function) { /* If both are functions, check result characteristics. */ - if (!check_result_characteristics (s1, s2, errmsg, err_len)) + if (!check_result_characteristics (s1, s2, errmsg, err_len) + || !check_result_characteristics (s2, s1, errmsg, err_len)) return 0; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8b6304f0ef2b..203fd13ddb04 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-09-20 Janus Weil + + PR fortran/58099 + * gfortran.dg/proc_ptr_43.f90: New. + 2013-09-18 Tobias Burnus PR fortran/57697 diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_43.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_43.f90 new file mode 100644 index 000000000000..b1f77a06ec65 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_43.f90 @@ -0,0 +1,19 @@ +! { dg-do compile } +! +! PR 58099: [4.8/4.9 Regression] [F03] over-zealous procedure-pointer error checking +! +! Contributed by Daniel Price + + implicit none + procedure(real), pointer :: wfunc + + wfunc => w_cubic + +contains + + pure real function w_cubic(q2) + real, intent(in) :: q2 + w_cubic = 0. + end function + +end