aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
authorSteven G. Kargl <kargl@gcc.gnu.org>2018-03-11 21:39:15 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2018-03-11 21:39:15 +0000
commit1813c97a6fd41062e5154e1fb0e7e2cc762306a5 (patch)
tree0a8e7c558de38b75e4ecd2d2b376c2de0ee42fb4 /gcc/fortran/resolve.c
parentfbe1f017435875f9bfd29d250b4ba2eaf4c79047 (diff)
downloadgcc-1813c97a6fd41062e5154e1fb0e7e2cc762306a5.zip
gcc-1813c97a6fd41062e5154e1fb0e7e2cc762306a5.tar.gz
gcc-1813c97a6fd41062e5154e1fb0e7e2cc762306a5.tar.bz2
re PR fortran/83939 (Constraint C1290 (elemental function cannot be allocatable) not enforced)
2018-03-11 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/83939 * resolve.c (resolve_fl_procedure): Enforce F2018:C15100. 2018-03-11 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/83939 * gfortran.dg/pr83939.f90 From-SVN: r258437
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r--gcc/fortran/resolve.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 6e20184..e28146a 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -12451,6 +12451,19 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
}
}
+ /* F2018, C15100: "The result of an elemental function shall be scalar,
+ and shall not have the POINTER or ALLOCATABLE attribute." The scalar
+ pointer is tested and caught elsewhere. */
+ if (sym->attr.elemental && sym->result
+ && (sym->result->attr.allocatable || sym->result->attr.pointer))
+ {
+ gfc_error ("Function result variable %qs at %L of elemental "
+ "function %qs shall not have an ALLOCATABLE or POINTER "
+ "attribute", sym->result->name,
+ &sym->result->declared_at, sym->name);
+ return false;
+ }
+
if (sym->attr.is_bind_c && sym->attr.is_c_interop != 1)
{
gfc_formal_arglist *curr_arg;