summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/reshape_rank7.f90
blob: a003de013a8ee454cf3b81252e39ce5d2f0adf2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
! { dg-do run }
! PR 21075:  Reshape with rank 7 used to segfault.
program main
  integer :: a(256), b(2,2,2,2,2,2,2)
  do i=1,256
     a(i) = i
  end do
  b = reshape(a(1:256:2), shape(b))
  do i1=1,2
     do i2=1,2
        do i3=1,2
           do i4=1,2
              do i5=1,2
                 do i6=1,2
                    do i7=1,2
                       if (b(i1,i2,i3,i4,i5,i6,i7) /= &
                            2*((i1-1)+(i2-1)*2+(i3-1)*4+(i4-1)*8+&
                            (i5-1)*16+(i6-1)*32+(i7-1)*64)+1) &
                            call abort
              end do
            end do
          end do
        end do
      end do
    end do
  end do
end program main