aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorHarald Anlauf <anlauf@gmx.de>2020-09-19 20:46:38 +0200
committerHarald Anlauf <anlauf@gmx.de>2020-09-19 20:46:38 +0200
commitf7d2d4be7650acceb9d39327e21ee04f640c152f (patch)
tree804fef361512f0dbd8234739965d2331ecf85a47 /gcc
parentc66c004ad610f4f02d5f065fe29c4c10f05ae13f (diff)
downloadgcc-f7d2d4be7650acceb9d39327e21ee04f640c152f.zip
gcc-f7d2d4be7650acceb9d39327e21ee04f640c152f.tar.gz
gcc-f7d2d4be7650acceb9d39327e21ee04f640c152f.tar.bz2
PR fortran/97036 - [F2018] Allow ELEMENTAL RECURSIVE procedure prefix
gcc/fortran/ChangeLog: * symbol.c (gfc_check_conflict): Allow ELEMENTAL RECURSIVE procedure prefix for -std=f2018. gcc/testsuite/ChangeLog: * gfortran.dg/pr97036.f90: New test.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/symbol.c2
-rw-r--r--gcc/testsuite/gfortran.dg/pr97036.f9027
2 files changed, 28 insertions, 1 deletions
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index abd3b5c..df1e896 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -569,7 +569,7 @@ gfc_check_conflict (symbol_attribute *attr, const char *name, locus *where)
conf_std (allocatable, dummy, GFC_STD_F2003);
conf_std (allocatable, function, GFC_STD_F2003);
conf_std (allocatable, result, GFC_STD_F2003);
- conf (elemental, recursive);
+ conf_std (elemental, recursive, GFC_STD_F2018);
conf (in_common, dummy);
conf (in_common, allocatable);
diff --git a/gcc/testsuite/gfortran.dg/pr97036.f90 b/gcc/testsuite/gfortran.dg/pr97036.f90
new file mode 100644
index 0000000..cfe51de
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr97036.f90
@@ -0,0 +1,27 @@
+! { dg-do compile }
+! { dg-options "-std=f2018" }
+! PR fortran/97036 - [F2018] Allow ELEMENTAL RECURSIVE procedure prefix
+
+module m97036
+ implicit none
+contains
+ impure elemental recursive subroutine foo (n)
+ integer, intent(in) :: n
+ integer :: k(n), f(n), i
+ k = [ (i-1, i=1,n) ]
+ f = fac (k)
+ print *, f
+ end subroutine foo
+ elemental recursive subroutine bla ()
+ end subroutine bla
+ elemental recursive function fac (k) result (f)
+ integer, intent(in) :: k
+ integer :: f
+ f = 1
+ if (k > 1) f = k*fac (k-1)
+ end function fac
+end module
+ use m97036
+ implicit none
+ call foo ([4,5])
+end