diff options
author | janus <janus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-09-29 11:57:35 +0000 |
---|---|---|
committer | janus <janus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-09-29 11:57:35 +0000 |
commit | 5684c61c0def2f1ad31c094d19977a66681c6e87 (patch) | |
tree | 6eb80c27b0e8d8f204611e0d47e28d64aefa066d | |
parent | 47fe598eb8e215961cb05d5424b5ef10c358ad9a (diff) | |
download | gcc-5684c61c0def2f1ad31c094d19977a66681c6e87.tar.gz |
2011-09-29 Janus Weil <janus@gcc.gnu.org>
PR fortran/50547
* resolve.c (resolve_formal_arglist): Fix pureness check for dummy
functions.
PR fortran/50553
* symbol.c (check_conflict): Forbid TARGET attribute for statement
functions.
2011-09-29 Janus Weil <janus@gcc.gnu.org>
PR fortran/50547
* gfortran.dg/pure_formal_proc_3.f90: New.
PR fortran/50553
* gfortran.dg/stfunc_7.f90: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@179345 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/fortran/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/fortran/resolve.c | 19 | ||||
-rw-r--r-- | gcc/fortran/symbol.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pure_formal_proc_3.f90 | 12 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/stfunc_7.f90 | 10 |
6 files changed, 52 insertions, 8 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 99d2d3c812a..ecd9fa3a740 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,13 @@ +2011-09-29 Janus Weil <janus@gcc.gnu.org> + + PR fortran/50547 + * resolve.c (resolve_formal_arglist): Fix pureness check for dummy + functions. + + PR fortran/50553 + * symbol.c (check_conflict): Forbid TARGET attribute for statement + functions. + 2011-09-27 Jakub Jelinek <jakub@redhat.com> * trans-types.c (gfc_type_for_size): Return wider type diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 13ecf1c2bf6..84db3ddb019 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -269,18 +269,21 @@ resolve_formal_arglist (gfc_symbol *proc) if (sym->attr.if_source != IFSRC_UNKNOWN) resolve_formal_arglist (sym); + /* F08:C1279. */ + if (gfc_pure (proc) + && sym->attr.flavor == FL_PROCEDURE && !gfc_pure (sym)) + { + gfc_error ("Dummy procedure '%s' of PURE procedure at %L must " + "also be PURE", sym->name, &sym->declared_at); + continue; + } + if (sym->attr.subroutine || sym->attr.external || sym->attr.intrinsic) { - if (gfc_pure (proc) && !gfc_pure (sym)) - { - gfc_error ("Dummy procedure '%s' of PURE procedure at %L must " - "also be PURE", sym->name, &sym->declared_at); - continue; - } - if (proc->attr.implicit_pure && !gfc_pure(sym)) proc->attr.implicit_pure = 0; + /* F08:C1289. */ if (gfc_elemental (proc)) { gfc_error ("Dummy procedure at %L not allowed in ELEMENTAL " @@ -382,7 +385,7 @@ resolve_formal_arglist (gfc_symbol *proc) if (gfc_elemental (proc)) { - /* F2008, C1289. */ + /* F08:C1289. */ if (sym->attr.codimension) { gfc_error ("Coarray dummy argument '%s' at %L to elemental " diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index 25186c977ad..46eccb46aba 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -684,6 +684,7 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where) { case PROC_ST_FUNCTION: conf2 (dummy); + conf2 (target); break; case PROC_MODULE: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 59aefbc9338..fb41e555112 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2011-09-29 Janus Weil <janus@gcc.gnu.org> + + PR fortran/50547 + * gfortran.dg/pure_formal_proc_3.f90: New. + + PR fortran/50553 + * gfortran.dg/stfunc_7.f90: New. + 2011-09-29 Artjoms Sinkarovs <artyom.shinkaroff@gmail.com> * gcc.c-torture/execute/vector-compare-1.c: New testcase. diff --git a/gcc/testsuite/gfortran.dg/pure_formal_proc_3.f90 b/gcc/testsuite/gfortran.dg/pure_formal_proc_3.f90 new file mode 100644 index 00000000000..38d4552801a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pure_formal_proc_3.f90 @@ -0,0 +1,12 @@ +! { dg-do compile } +! +! PR 50547: dummy procedure argument of PURE shall be PURE +! +! Contributed by Vittorio Zecca <zeccav@gmail.com> + +pure function f(proc) + interface + function proc() ! { dg-error "must also be PURE" } + end + end interface +end diff --git a/gcc/testsuite/gfortran.dg/stfunc_7.f90 b/gcc/testsuite/gfortran.dg/stfunc_7.f90 new file mode 100644 index 00000000000..1e116462525 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/stfunc_7.f90 @@ -0,0 +1,10 @@ +! { dg-do compile } +! { dg-options "-std=legacy" } +! +! PR 50553: statement function cannot be target (r178939) +! +! Contributed by Vittorio Zecca <zeccav@gmail.com> + +f(x)=x +target f ! { dg-error "attribute conflicts with" } +end |