diff options
author | Tobias Burnus <burnus@net-b.de> | 2011-02-11 22:07:17 +0100 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2011-02-11 22:07:17 +0100 |
commit | a26e8df4dcf99181598e35b599663c6f484dec72 (patch) | |
tree | 56b66b81ad62bc528a894a33f1d79ba5c4b08e46 /gcc/fortran | |
parent | 3f82421f9c460408f21dc8a68079957aada10c0e (diff) | |
download | gcc-a26e8df4dcf99181598e35b599663c6f484dec72.zip gcc-a26e8df4dcf99181598e35b599663c6f484dec72.tar.gz gcc-a26e8df4dcf99181598e35b599663c6f484dec72.tar.bz2 |
re PR fortran/47550 (PURE with VALUE and w/o INTENT: add gfc_notify_std (GFC_STD_F2008 ?)
2011-02-11 Tobias Burnus <burnus@net-b.de>
PR fortran/47550
* resolve.c (resolve_formal_arglist): PURE with VALUE
and no INTENT: Add -std= diagnostics.
2011-02-11 Tobias Burnus <burnus@net-b.de>
PR fortran/47550
* gfortran.dg/pure_formal_2.f90: New.
From-SVN: r170060
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/resolve.c | 30 |
2 files changed, 28 insertions, 8 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 80cc4da..9980d4d 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2011-02-11 Tobias Burnus <burnus@net-b.de> + + PR fortran/47550 + * resolve.c (resolve_formal_arglist): PURE with VALUE + and no INTENT: Add -std= diagnostics. + 2011-02-09 Janus Weil <janus@gcc.gnu.org> PR fortran/47352 diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 0fe0672..fefb643 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -341,17 +341,31 @@ resolve_formal_arglist (gfc_symbol *proc) if (gfc_pure (proc) && !sym->attr.pointer && sym->attr.flavor != FL_PROCEDURE) { - if (proc->attr.function && sym->attr.intent != INTENT_IN - && !sym->attr.value) - gfc_error ("Argument '%s' of pure function '%s' at %L must be " - "INTENT(IN) or VALUE", sym->name, proc->name, - &sym->declared_at); + if (proc->attr.function && sym->attr.intent != INTENT_IN) + { + if (sym->attr.value) + gfc_notify_std (GFC_STD_F2008, "Fortran 2008: Argument '%s' " + "of pure function '%s' at %L with VALUE " + "attribute but without INTENT(IN)", sym->name, + proc->name, &sym->declared_at); + else + gfc_error ("Argument '%s' of pure function '%s' at %L must be " + "INTENT(IN) or VALUE", sym->name, proc->name, + &sym->declared_at); + } - if (proc->attr.subroutine && sym->attr.intent == INTENT_UNKNOWN - && !sym->attr.value) - gfc_error ("Argument '%s' of pure subroutine '%s' at %L must " + if (proc->attr.subroutine && sym->attr.intent == INTENT_UNKNOWN) + { + if (sym->attr.value) + gfc_notify_std (GFC_STD_F2008, "Fortran 2008: Argument '%s' " + "of pure subroutine '%s' at %L with VALUE " + "attribute but without INTENT", sym->name, + proc->name, &sym->declared_at); + else + gfc_error ("Argument '%s' of pure subroutine '%s' at %L must " "have its INTENT specified or have the VALUE " "attribute", sym->name, proc->name, &sym->declared_at); + } } if (proc->attr.implicit_pure && !sym->attr.pointer |