summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/host_assoc_function_4.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/host_assoc_function_4.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/host_assoc_function_4.f9030
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/host_assoc_function_4.f90 b/gcc/testsuite/gfortran.dg/host_assoc_function_4.f90
new file mode 100644
index 000000000..799eb0078
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/host_assoc_function_4.f90
@@ -0,0 +1,30 @@
+! { dg-do run }
+!
+! PR fortran/37445, in which the contained 's1' would be
+! ignored and the use+host associated version used.
+!
+! Contributed by Norman S Clerman < clerman@fuse.net>
+!
+MODULE M1
+CONTAINS
+ integer function S1 ()
+ s1 = 0
+ END function
+END MODULE
+
+MODULE M2
+ USE M1
+CONTAINS
+ SUBROUTINE S2
+ if (s1 () .ne. 1) call abort
+ CONTAINS
+ integer function S1 ()
+ s1 = 1
+ END function
+ END SUBROUTINE
+END MODULE
+
+ USE M2
+ CALL S2
+END
+! { dg-final { cleanup-modules "M1 M2" } }