diff options
author | Janus Weil <janus@gcc.gnu.org> | 2011-02-08 23:51:04 +0100 |
---|---|---|
committer | Janus Weil <janus@gcc.gnu.org> | 2011-02-08 23:51:04 +0100 |
commit | 7522a064991a90ac167f51ff021df39975af067d (patch) | |
tree | 4362ef6f48f02cc5c8c1ab92556ccfb55016ca70 /gcc/fortran/expr.c | |
parent | 4ad70280ecdbbec4582c2baaf9cc58d447bb78fd (diff) | |
download | gcc-7522a064991a90ac167f51ff021df39975af067d.zip gcc-7522a064991a90ac167f51ff021df39975af067d.tar.gz gcc-7522a064991a90ac167f51ff021df39975af067d.tar.bz2 |
re PR fortran/45290 ([F08] pointer initialization)
2011-02-08 Janus Weil <janus@gcc.gnu.org>
PR fortran/45290
* expr.c (gfc_check_assign_symbol): Reject pointers as pointer
initialization target.
2011-02-08 Janus Weil <janus@gcc.gnu.org>
PR fortran/45290
* gfortran.dg/pointer_init_6.f90: New.
From-SVN: r169948
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r-- | gcc/fortran/expr.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index bcc23fc..b30bc64 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -3608,7 +3608,7 @@ gfc_check_assign_symbol (gfc_symbol *sym, gfc_expr *rvalue) "must not be ALLOCATABLE "); return FAILURE; } - if (!attr.target) + if (!attr.target || attr.pointer) { gfc_error ("Pointer initialization target at %C " "must have the TARGET attribute"); @@ -3621,6 +3621,18 @@ gfc_check_assign_symbol (gfc_symbol *sym, gfc_expr *rvalue) return FAILURE; } } + + if (sym->attr.proc_pointer && rvalue->expr_type != EXPR_NULL) + { + /* F08:C1220. Additional checks for procedure pointer initialization. */ + symbol_attribute attr = gfc_expr_attr (rvalue); + if (attr.proc_pointer) + { + gfc_error ("Procedure pointer initialization target at %L " + "may not be a procedure pointer", &rvalue->where); + return FAILURE; + } + } return SUCCESS; } |