Debian Codegraph @

gcc/testsuite/gfortran.dg/pr63797.f90

raw
1 ! { dg-do compile }
2 ! PR63797 - Bogus ambiguous reference to 'sqrt'
3
4 module mod1
5 implicit none
6 real, parameter :: z = sqrt (0.0)
7 real :: w = sqrt (1.0)
8 interface
9 pure real function sqrt_ifc (x)
10 real, intent(in) :: x
11 end function sqrt_ifc
12 end interface
13 contains
14 pure function myroot () result (f)
15 procedure(sqrt_ifc), pointer :: f
16 intrinsic :: sqrt
17 f => sqrt
18 end function myroot
19 end module mod1
20
21 module mod2
22 implicit none
23 type t
24 real :: a = 0.
25 end type
26 interface sqrt
27 module procedure sqrt
28 end interface
29 contains
30 elemental function sqrt (a)
31 type(t), intent(in) :: a
32 type(t) :: sqrt
33 sqrt% a = a% a
34 end function sqrt
35 end module mod2
36
37 module mod3
38 implicit none
39 abstract interface
40 function real_func (x)
41 real :: real_func
42 real, intent (in) :: x
43 end function real_func
44 end interface
45 intrinsic :: sqrt
46 procedure(real_func), pointer :: real_root => sqrt
47 end module mod3
48
49 program test
50 use mod1
51 use mod2
52 use mod3
53 implicit none
54 type(t) :: x, y
55 procedure(sqrt_ifc), pointer :: root
56 root => myroot ()
57 y = sqrt (x)
58 y% a = sqrt (x% a) + z - w + root (x% a)
59 y% a = real_root (x% a)
60 end program test