Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gfortran.dg / intrinsic_actual_1.f
blob7596e322305d5749d443b7f4e7fb32a8916e51e1
1 ! { dg-do compile }
2 ! Tests the fix for PR27554, where the actual argument reference
3 ! to abs would not be recognised as being to an intrinsic
4 ! procedure and would produce junk in the assembler.
6 ! Contributed by Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
8 subroutine foo (proc, z)
9 external proc
10 real proc, z
11 if ((proc(z) .ne. abs (z)) .and.
12 & (proc(z) .ne. alog10 (abs(z)))) call abort ()
13 return
14 end
16 external cos
17 interface
18 function sin (a)
19 real a, sin
20 end function sin
21 end interface
24 intrinsic alog10
25 real x
26 x = 100.
27 ! The reference here would prevent the actual arg from being seen
28 ! as an intrinsic procedure in the call to foo.
29 x = -abs(x)
30 call foo(abs, x)
31 ! The intrinsic function can be locally over-ridden by an interface
32 call foo(sin, x)
33 ! or an external declaration.
34 call foo(cos, x)
35 ! Just make sure with another intrinsic but this time not referenced.
36 call foo(alog10, -x)
37 end
39 function sin (a)
40 real a, sin
41 sin = -a
42 return
43 end
45 function cos (a)
46 real a, cos
47 cos = -a
48 return
49 end