fix pr/45972
[official-gcc.git] / gcc / testsuite / gfortran.dg / host_dummy_index_1.f90
blob62080f940f70f3767a9dfe769ca178cc111fa3df
1 ! { dg-do run }
2 ! Tests the fix for PR23446. Based on PR example.
3 ! Contributed by Paul Thomas <pault@gcc.gnu.org>
5 ! Tests furthermore the fix for PR fortran/29916.
6 ! Test contributed by Marco Restelli <mrestelli@gmail.com>
8 PROGRAM TST
9 INTEGER IMAX
10 INTEGER :: A(4) = 1
11 IMAX=2
13 CALL S(A)
14 CALL T(A)
15 CALL U(A)
16 if ( ALL(A.ne.(/2,2,3,4/))) CALL ABORT ()
17 if ( ALL(F().ne.(/2.0,2.0/))) CALL ABORT()
19 CONTAINS
20 SUBROUTINE S(A)
21 INTEGER A(IMAX)
22 a = 2
23 END SUBROUTINE S
24 SUBROUTINE T(A)
25 INTEGER A(3:IMAX+4)
26 A(5:IMAX+4) = 3
27 END SUBROUTINE T
28 SUBROUTINE U(A)
29 INTEGER A(2,IMAX)
30 A(2,2) = 4
31 END SUBROUTINE U
32 FUNCTION F()
33 real :: F(IMAX)
34 F = 2.0
35 END FUNCTION F
36 ENDPROGRAM TST