summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/reshape_order_4.f90
blob: c66df8e83d809cb971ecc38a4f2d2afe8e72fe6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
! { dg-do run }
! { dg-options "-fbounds-check" }
! { dg-shouldfail "Value 0 out of range in ORDER argument to RESHAPE intrinsic" }
program main
  implicit none
  integer(kind=4), dimension(6) :: source1 = (/ 1, 2, 3, 4, 5, 6 /)
  integer, dimension(2) :: shape1 = (/ 2, 3/)
  integer(kind=4), dimension(2) :: pad1 = (/ 0, 0/)
  character(len=200) :: l1, l2
  integer :: i1, i2

  l1 = "0 2"
  read(unit=l1,fmt=*) i1, i2
  write (unit=l2,fmt=*) reshape(source1, shape1, pad1, (/i1, i2/)) ! Invalid
end program main
! { dg-output "Fortran runtime error: Value 0 out of range in ORDER argument to RESHAPE intrinsic" }