aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/pure_byref_1.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gfortran.dg/pure_byref_1.f90')
-rw-r--r--gcc-4.9/gcc/testsuite/gfortran.dg/pure_byref_1.f9015
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gfortran.dg/pure_byref_1.f90 b/gcc-4.9/gcc/testsuite/gfortran.dg/pure_byref_1.f90
new file mode 100644
index 000000000..5e080e5af
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gfortran.dg/pure_byref_1.f90
@@ -0,0 +1,15 @@
+! { dg-do run }
+! PR 22607: PURE/ELEMENTAL return-by-reference functions
+program main
+ implicit none
+ character(2), dimension(2) :: a, b
+ a = 'ok'
+ b = fun(a)
+ if (.not.all(b == 'ok')) call abort()
+contains
+ elemental function fun(a)
+ character(*), intent(in) :: a
+ character(len(a)) :: fun
+ fun = a
+ end function fun
+end program main