diff options
author | Tobias Burnus <burnus@net-b.de> | 2010-10-21 08:15:30 +0200 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2010-10-21 08:15:30 +0200 |
commit | 9b565d654630853788cce2ea28c6586593bc931b (patch) | |
tree | 7f346e070e3b514431354b5897d5ea38d8db089d /gcc/fortran/expr.c | |
parent | 0fd4b31d684af56704c69cdbc8a0c891403ac672 (diff) | |
download | gcc-9b565d654630853788cce2ea28c6586593bc931b.zip gcc-9b565d654630853788cce2ea28c6586593bc931b.tar.gz gcc-9b565d654630853788cce2ea28c6586593bc931b.tar.bz2 |
re PR fortran/46100 ([Fortran 2008] Non-variable pointer expression as actual argument to INTENT(OUT) non-pointer dummy)
2010-10-21 Tobias Burnus <burnus@net-b.de>
PR fortran/46100
* expr.c (gfc_check_vardef_context): Treat pointer functions
as variables.
2010-10-21 Tobias Burnus <burnus@net-b.de>
PR fortran/46100
* gfortran.dg/ptr-func-1.f90: New.
* gfortran.dg/ptr-func-2.f90: New.
From-SVN: r165749
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r-- | gcc/fortran/expr.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 5711634..ef516a4 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -4316,7 +4316,18 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, const char* context) symbol_attribute attr; gfc_ref* ref; - if (e->expr_type != EXPR_VARIABLE) + if (!pointer && e->expr_type == EXPR_FUNCTION + && e->symtree->n.sym->result->attr.pointer) + { + if (!(gfc_option.allow_std & GFC_STD_F2008)) + { + if (context) + gfc_error ("Fortran 2008: Pointer functions in variable definition" + " context (%s) at %L", context, &e->where); + return FAILURE; + } + } + else if (e->expr_type != EXPR_VARIABLE) { if (context) gfc_error ("Non-variable expression in variable definition context (%s)" |