nvptx, libgfortran: Switch out of "minimal" mode
[official-gcc.git] / gcc / testsuite / gfortran.dg / f2c_9.f90
blobdc83341f02ee651a4c5097d53cd34a52beed708a
1 ! { dg-do run }
2 ! { dg-options "-ff2c" }
3 ! PR 34868
5 function f(a) result(res)
6 implicit none
7 real(8), intent(in) :: a(:)
8 complex(8) :: res
10 res = cmplx(sum(a),product(a),8)
11 end function f
13 function g(a)
14 implicit none
15 real(8), intent(in) :: a(:)
16 complex(8) :: g
18 g = cmplx(sum(a),product(a),8)
19 end function g
21 program test
22 real(8) :: a(1,5)
23 complex(8) :: c
24 integer :: i
26 interface
27 complex(8) function f(a)
28 real(8), intent(in) :: a(:)
29 end function f
30 function g(a) result(res)
31 real(8), intent(in) :: a(:)
32 complex(8) :: res
33 end function g
34 end interface
36 do i = 1, 5
37 a(1,i) = sqrt(real(i,kind(a)))
38 end do
40 c = f(a(1,:))
41 call check (real(c), sum(a))
42 call check (imag(c), product(a))
44 c = g(a(1,:))
45 call check (real(c), sum(a))
46 call check (imag(c), product(a))
47 contains
48 subroutine check (a, b)
49 real(8), intent(in) :: a, b
50 if (abs(a - b) > 1.e-10_8) STOP 1
51 end subroutine check
52 end program test