diff options
Diffstat (limited to 'gcc/testsuite/gfortran.dg/host_assoc_function_6.f90')
-rw-r--r-- | gcc/testsuite/gfortran.dg/host_assoc_function_6.f90 | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/host_assoc_function_6.f90 b/gcc/testsuite/gfortran.dg/host_assoc_function_6.f90 new file mode 100644 index 000000000..28cd7c836 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/host_assoc_function_6.f90 @@ -0,0 +1,35 @@ +! { dg-do compile } +! Tests the fix for PR38765 in which the use associated symbol +! 'fun' was confused with the contained function in 'mod_b' +! because the real name was being used instead of the 'use' +! name.. +! +! Contributed by Paul Thomas <pault@gcc.gnu.org> +! from a report by Marco Restelli. +! +module mod_a + implicit none + public :: fun + private +contains + pure function fun(x) result(mu) + real, intent(in) :: x(:,:) + real :: mu(2,2,size(x,2)) + mu = 2.0 + end function fun +end module mod_a + +module mod_b + use mod_a, only: & + a_fun => fun + implicit none + private +contains + pure function fun(x) result(mu) + real, intent(in) :: x(:,:) + real :: mu(2,2,size(x,2)) + mu = a_fun(x) + end function fun +end module mod_b + +! { dg-final { cleanup-modules "mod_a mod_b" } } |