aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorJanus Weil <janus@gcc.gnu.org>2012-09-17 14:50:34 +0200
committerJanus Weil <janus@gcc.gnu.org>2012-09-17 14:50:34 +0200
commita4a76e5242236301f4713efae30642fb39e5d0eb (patch)
treeccf8bb60f63d400aee5500fda6226de40f7c80c4 /gcc/fortran
parent640a4c59ed729e48250032b039a5239cd95c1d41 (diff)
downloadgcc-a4a76e5242236301f4713efae30642fb39e5d0eb.zip
gcc-a4a76e5242236301f4713efae30642fb39e5d0eb.tar.gz
gcc-a4a76e5242236301f4713efae30642fb39e5d0eb.tar.bz2
re PR fortran/54285 ([F03] Calling a PPC with proc-ptr result)
2012-09-17 Janus Weil <janus@gcc.gnu.org> PR fortran/54285 * expr.c (gfc_check_pointer_assign): Correctly handle procedure pointers as function results. * primary.c (gfc_match_varspec): Allow to call a PPC with proc-ptr result. 2012-09-17 Janus Weil <janus@gcc.gnu.org> PR fortran/54285 * gfortran.dg/proc_ptr_result_7.f90: New. From-SVN: r191383
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog8
-rw-r--r--gcc/fortran/expr.c12
-rw-r--r--gcc/fortran/primary.c5
3 files changed, 20 insertions, 5 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 3f6e3be..3d7e009 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,11 @@
+2012-09-17 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/54285
+ * expr.c (gfc_check_pointer_assign): Correctly handle procedure pointers
+ as function results.
+ * primary.c (gfc_match_varspec): Allow to call a PPC with proc-ptr
+ result.
+
2012-09-17 Tobias Burnus <burnus@net-b.de>
PR fortran/54603
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index dced05d..4bba438 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -3513,8 +3513,16 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue)
comp = gfc_get_proc_ptr_comp (rvalue);
if (comp)
{
- s2 = comp->ts.interface;
- name = comp->name;
+ if (rvalue->expr_type == EXPR_FUNCTION)
+ {
+ s2 = comp->ts.interface->result;
+ name = comp->ts.interface->result->name;
+ }
+ else
+ {
+ s2 = comp->ts.interface;
+ name = comp->name;
+ }
}
else if (rvalue->expr_type == EXPR_FUNCTION)
{
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index cadc20c..f362f75 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -2004,8 +2004,7 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag,
primary->ts = component->ts;
- if (component->attr.proc_pointer && ppc_arg
- && !gfc_matching_procptr_assignment)
+ if (component->attr.proc_pointer && ppc_arg)
{
/* Procedure pointer component call: Look for argument list. */
m = gfc_match_actual_arglist (sub_flag,
@@ -2014,7 +2013,7 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag,
return MATCH_ERROR;
if (m == MATCH_NO && !gfc_matching_ptr_assignment
- && !matching_actual_arglist)
+ && !gfc_matching_procptr_assignment && !matching_actual_arglist)
{
gfc_error ("Procedure pointer component '%s' requires an "
"argument list at %C", component->name);