diff options
author | Janus Weil <janus@gcc.gnu.org> | 2012-09-16 22:12:21 +0200 |
---|---|---|
committer | Janus Weil <janus@gcc.gnu.org> | 2012-09-16 22:12:21 +0200 |
commit | 37bfd49f329f3c2107068040c1421cfb6ef71fcb (patch) | |
tree | a2d74d100a01d6dc9214dc1f4d1b6f03f9947d6b /gcc/fortran | |
parent | 1d1b7dc4221762338014df6586e9ac0cbef2fed7 (diff) | |
download | gcc-37bfd49f329f3c2107068040c1421cfb6ef71fcb.zip gcc-37bfd49f329f3c2107068040c1421cfb6ef71fcb.tar.gz gcc-37bfd49f329f3c2107068040c1421cfb6ef71fcb.tar.bz2 |
re PR fortran/54387 ([F03] Wrongly accepts non-proc result variable on the RHS of a proc-pointer assignment)
2012-09-16 Janus Weil <janus@gcc.gnu.org>
PR fortran/54387
* expr.c (gfc_check_pointer_assign): Check for result of embracing
function.
2012-09-16 Janus Weil <janus@gcc.gnu.org>
PR fortran/54387
* gfortran.dg/proc_ptr_38.f90: New.
From-SVN: r191364
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/expr.c | 9 |
2 files changed, 15 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 24ff91f..bf9f0b93 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2012-09-16 Janus Weil <janus@gcc.gnu.org> + + PR fortran/54387 + * expr.c (gfc_check_pointer_assign): Check for result of embracing + function. + 2012-09-16 Tobias Burnus <burnus@net-b.de> * trans-decl.c (gfc_generate_function_code): Fix diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index bc1f5e3..dced05d 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -3430,6 +3430,15 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue) gfc_resolve_intrinsic (sym, &rvalue->where); attr = gfc_expr_attr (rvalue); } + /* Check for result of embracing function. */ + if (sym == gfc_current_ns->proc_name + && sym->attr.function && sym->result == sym) + { + gfc_error ("Function result '%s' is invalid as proc-target " + "in procedure pointer assignment at %L", + sym->name, &rvalue->where); + return FAILURE; + } } if (attr.abstract) { |