aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/submodule_23.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/submodule_23.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/submodule_23.f9029
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/submodule_23.f90 b/gcc/testsuite/gfortran.dg/submodule_23.f90
new file mode 100644
index 00000000000..63674fb4993
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/submodule_23.f90
@@ -0,0 +1,29 @@
+! { dg-do compile }
+!
+! Test the fix for PR79402, in which the module procedure 'fun1' picked
+! up a spurious symbol for the dummy 'n' in the specification expression
+! for the result 'y'.
+!
+! Contributed by Chris Coutinho <chrisbcoutinho@gmail.com>
+!
+module mod
+ interface myfun
+ module function fun1(n) result(y)
+ integer, intent(in) :: n
+ real, dimension(n) :: y
+ end function fun1
+ end interface myfun
+
+end module mod
+
+submodule (mod) submod
+contains
+ module procedure fun1
+ integer :: i
+ y = [(float (i), i = 1, n)]
+ end procedure fun1
+end submodule
+
+ use mod
+ print *, fun1(10)
+end