nvptx, libgfortran: Switch out of "minimal" mode
[official-gcc.git] / gcc / testsuite / gfortran.dg / PR93308.f90
blobee116f961dee62cf7a632e6b14ac3cfbd64e367d
1 ! { dg-do run }
3 ! Test the fix for PR94331
5 ! Contributed by Robin Hogan <r.j.hogan@reading.ac.uk>
8 program test
10 use, intrinsic :: iso_c_binding, only: &
11 c_int, c_float
13 implicit none
15 integer :: i
16 integer, parameter :: n = 11
17 real(kind=c_float), parameter :: u(*) = [(real(i, kind=c_float), i=1,n)]
19 real(kind=c_float), allocatable :: A(:)
20 real(kind=c_float) :: E(n)
21 integer(kind=c_int) :: l1, l2, l3
23 allocate(A, source=u)
24 l1 = lbound(A, 1)
25 call routine_bindc(A, l2) ! in gcc-9.2.1 this changes lbound of A...
26 l3 = lbound(A, 1)
27 if (l1 /= 1) stop 1
28 if (l1 /= l2) stop 2
29 if (l1 /= l3) stop 3
30 if (any(abs(A(1:n)-u)>0.0_c_float)) stop 4
31 deallocate(A)
33 E = u
34 l1 = lbound(E, 1)
35 call routine_bindc(E, l2) ! ...but does not change lbound of E
36 l3 = lbound(E, 1)
37 if (l1 /= 1) stop 5
38 if (l1 /= l2) stop 6
39 if (l1 /= l3) stop 7
40 if (any(abs(E(1:n)-u)>0.0_c_float)) stop 8
42 contains
44 subroutine routine_bindc(v, l) bind(c)
45 real(kind=c_float), intent(inout) :: v(:)
46 integer(kind=c_int), intent(out) :: l
48 l = lbound(v, 1)
49 if (any(abs(v(1:n)-u)>0.0_c_float)) stop 9
50 end subroutine routine_bindc
52 end program test