OSDN Git Service

gcc/fortran/
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / mvbits_7.f90
1 ! { dg-do run }
2
3 ! PR fortran/38883
4 ! This ICE'd because the temporary-creation in the MVBITS call was wrong.
5
6 ! Contributed by Paul Richard Thomas <paul.richard.thomas@gmail.com>
7
8   type t
9     integer  ::  I
10     character(9)  :: chr
11   end type
12   type(t) :: x(4,3)
13   type(t) :: y(4,3)
14   x = reshape ([((t (i*j, "a"),i = 1,4), j=1,3)], [4,3])
15   call foo (x)
16   y = reshape ([((t (i*j*2, "a"),i = 1,4), j=1,3)], [4,3])
17   call bar(y, 4, 3, 1, -1, -4, -3)
18   if (any (x%i .ne. y%i)) call abort
19 contains
20   SUBROUTINE foo (x)
21     TYPE(t) x(4, 3)      ! No dependency at all
22     CALL MVBITS (x%i, 0, 6, x%i, 8)
23     x%i = x%i * 2
24   END SUBROUTINE
25   SUBROUTINE bar (x, NF4, NF3, NF1, MF1, MF4, MF3)
26     TYPE(t) x(NF4, NF3)  ! Dependency through variable indices
27     CALL MVBITS (x(NF4:NF1:MF1, NF1:NF3)%i, 1, &
28                  6, x(-MF4:-MF1:-NF1, -MF1:-MF3)%i, 9)
29   END SUBROUTINE
30 end