1! This can fail because BB is not resolved correctly.
2module M1
3
4INTEGER p
5
6CONTAINS
7subroutine AA ()
8   implicit NONE
9   p = BB ()
10 CONTAINS
11   subroutine AA_1 ()
12     implicit NONE
13     integer :: i
14     i = BB ()
15   end subroutine
16
17   function BB()
18   integer :: BB
19     BB = 1
20   end function
21end subroutine
22
23function BB()
24  implicit NONE
25  integer :: BB
26  BB = 2
27end function
28end module
29
30program P1
31  USE M1
32  implicit none
33  p = 0
34  call AA ()
35  if (p /= 1) STOP 1
36end
37