summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/fortran/ChangeLog8
-rw-r--r--gcc/fortran/expr.c8
-rw-r--r--gcc/fortran/interface.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_43.f9019
5 files changed, 34 insertions, 9 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index de38d3f00fa..0e4d688f975 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,11 @@
+2013-09-20 Janus Weil <janus@gcc.gnu.org>
+
+ 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 <burnus@net-b.de>
* expr.c (gfc_check_assign_symbol): Free lvalue.ref.
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index 666309245f0..b2af32816e5 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 aa88b3c3fa6..b8786440fbe 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 8b6304f0ef2..203fd13ddb0 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2013-09-20 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/58099
+ * gfortran.dg/proc_ptr_43.f90: New.
+
2013-09-18 Tobias Burnus <burnus@net-b.de>
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 00000000000..b1f77a06ec6
--- /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 <daniel.price@monash.edu>
+
+ 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