OSDN Git Service

PR debug/43329
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / vector_subscript_5.f90
1 ! { dg-do run }
2 !
3 ! Test the fix for PR37749 in which the expression in line 13 would cause an ICE
4 ! because the upper value of the loop range was not set.
5 !
6 ! Contributed by Jakub Jelinek <jakub@gcc.gnu.org>
7 !
8 subroutine subr (m, n, a, b, c, d, p)
9   implicit none
10   integer m, n
11   real a(m,n), b(m,n), c(n,n), d(m,n)
12   integer p(n)
13   d = a(:,p) - matmul(b, c)
14 end subroutine
15
16   implicit none
17   integer i
18   real a(3,2), b(3,2), c(2,2), d(3,2)
19   integer p(2)
20   a = reshape ((/(i, i = 1, 6)/), (/3, 2/))
21   b = 1
22   c = 2
23   p = 2
24   call subr (3, 2, a, b, c, d, p)
25   if (any (d .ne. reshape ((/(mod (i + 2, 3), i = 1, 6)/), (/3, 2/)))) call abort
26 end