1! { dg-do compile }
2! Tests the fix for PR35997, in which the use association of renamed
3! valid2 and flag2 was treated as if the renaming were done on use
4! association in the main program.  Thus, the following, direct use
5! association of valid and flag did not occur.
6!
7! Contributed by Drew McCormack <drewmccormack@mac.com>
8!
9module funcinterfacemod
10  interface
11    logical function valid ()
12    end function
13  end interface
14  logical :: flag = .true.
15end module
16
17module secondmod
18  use funcinterfacemod, valid2 => valid, flag2 => flag
19end module
20
21logical function valid ()
22  valid = .true.
23end function
24
25program main
26  use secondmod
27  use funcinterfacemod
28  if (valid ()) then
29    print *, 'Is Valid'
30  endif
31  if (flag) then
32    print *, 'Is flag'
33  endif
34end program
35