summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/pure_initializer_1.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/pure_initializer_1.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/pure_initializer_1.f9017
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/pure_initializer_1.f90 b/gcc/testsuite/gfortran.dg/pure_initializer_1.f90
new file mode 100644
index 000000000..6f521a04f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pure_initializer_1.f90
@@ -0,0 +1,17 @@
+! { dg-do compile }
+! Tests the fix for PR32881, in which the initialization
+! of 'p' generated an error because the pureness of 'bar'
+! escaped.
+!
+! Contributed by Janne Blomqvist <jb@gcc.gnu.org>
+!
+subroutine foo ()
+ integer, pointer :: p => NULL()
+contains
+ pure function bar (a)
+ integer, intent(in) :: a
+ integer :: bar
+ bar = a
+ end function bar
+end subroutine foo
+