diff options
author | Daniel Kraft <d@domob.eu> | 2010-08-15 17:28:10 +0200 |
---|---|---|
committer | Daniel Kraft <domob@gcc.gnu.org> | 2010-08-15 17:28:10 +0200 |
commit | e6c148988cfe585abf4eb2d3f1839f97a83cc1a9 (patch) | |
tree | e3e1c7f09d4ce2dcff79e7b4801680172b017c43 /gcc/fortran/resolve.c | |
parent | 69f11a1360a23fd4aa0567ab1c4b62dcc5be8127 (diff) | |
download | gcc-e6c148988cfe585abf4eb2d3f1839f97a83cc1a9.zip gcc-e6c148988cfe585abf4eb2d3f1839f97a83cc1a9.tar.gz gcc-e6c148988cfe585abf4eb2d3f1839f97a83cc1a9.tar.bz2 |
re PR fortran/45197 ([F2008] Allow IMPURE elemental procedures)
2010-08-15 Daniel Kraft <d@domob.eu>
PR fortran/45197
* decl.c (gfc_match_prefix): Match IMPURE prefix and mark ELEMENTAL
routines not IMPURE also as PURE.
* intrinsic.c (enum klass): New class `CLASS_PURE' and renamed
`NO_CLASS' in `CLASS_IMPURE'.
(add_sym): Set symbol-attributes `pure' and `elemental' correctly.
(add_sym_0s): Renamed `NO_CLASS' in `CLASS_IMPURE'.
(add_functions): Ditto.
(add_subroutines): Ditto and mark `MOVE_ALLOC' as CLASS_PURE.
* resolve.c (gfc_pure): Do not treat ELEMENTAL as automatically PURE.
(resolve_formal_arglist): Check that arguments to ELEMENTAL procedures
are not ALLOCATABLE and have their INTENT specified.
2010-08-15 Daniel Kraft <d@domob.eu>
PR fortran/45197
* gfortran.dg/elemental_args_check_3.f90: New test.
* gfortran.dg/impure_1.f08: New test.
* gfortran.dg/impure_2.f08: New test.
* gfortran.dg/impure_3.f90: New test.
* gfortran.dg/typebound_proc_6.f03: Changed expected error message.
From-SVN: r163261
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r-- | gcc/fortran/resolve.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 0e68af6..d274c6a 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -278,6 +278,14 @@ resolve_formal_arglist (gfc_symbol *proc) continue; } + if (sym->attr.allocatable) + { + gfc_error ("Argument '%s' of elemental procedure at %L cannot " + "have the ALLOCATABLE attribute", sym->name, + &sym->declared_at); + continue; + } + if (sym->attr.pointer) { gfc_error ("Argument '%s' of elemental procedure at %L cannot " @@ -293,6 +301,14 @@ resolve_formal_arglist (gfc_symbol *proc) &sym->declared_at); continue; } + + if (sym->attr.intent == INTENT_UNKNOWN) + { + gfc_error ("Argument '%s' of elemental procedure '%s' at %L must " + "have its INTENT specified", sym->name, proc->name, + &sym->declared_at); + continue; + } } /* Each dummy shall be specified to be scalar. */ @@ -12474,7 +12490,7 @@ gfc_pure (gfc_symbol *sym) if (sym == NULL) return 0; attr = sym->attr; - if (attr.flavor == FL_PROCEDURE && (attr.pure || attr.elemental)) + if (attr.flavor == FL_PROCEDURE && attr.pure) return 1; } return 0; @@ -12482,7 +12498,7 @@ gfc_pure (gfc_symbol *sym) attr = sym->attr; - return attr.flavor == FL_PROCEDURE && (attr.pure || attr.elemental); + return attr.flavor == FL_PROCEDURE && attr.pure; } |