2009-07-17 Richard Guenther <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / host_assoc_function_9.f90
blob58cae435fb6be317756341bb9b638a986f7e564e
1 ! { dg-do run }
2 ! Tests the fix for the bug PR40629, in which the reference to 'x'
3 ! in 'upper' wrongly host-associated with the symbol 'x' at module
4 ! leve rather than the function.
6 ! Contributed by Philippe Marguinaud <philippe.marguinaud@meteo.fr>
8 MODULE m
9 REAL :: x = 0
10 CONTAINS
11 subroutine s
12 call upper
13 call lower
14 CONTAINS
15 SUBROUTINE upper
16 y = x(3,1)
17 if (int(y) .ne. 3) call abort
18 END SUBROUTINE
19 FUNCTION x(n, m)
20 x = m*n
21 END FUNCTION
22 SUBROUTINE lower
23 y = x(2,1)
24 if (int(y) .ne. 2) call abort
25 END SUBROUTINE
26 END SUBROUTINE
27 END MODULE
29 use m
30 call s
31 end
32 ! { dg-final { cleanup-modules "m" } }