view gcc/testsuite/gfortran.dg/array_constructor_10.f90 @ 144:8f4e72ab4e11

fix segmentation fault caused by nothing next cur_op to end
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 21:23:56 +0900
parents 84e7813d76e9
children
line wrap: on
line source

! Like array_constructor_6.f90, but check constructors that apply
! an elemental function to an array.
! { dg-do run }
program main
  implicit none
  call build (200)
contains
  subroutine build (order)
    integer :: order, i

    call test (order, (/ (abs ((/ i, -i, -i * 2 /)), i = 1, order) /))
    call test (order, abs ((/ ((/ -i, -i, i * 2 /), i = 1, order) /)))
    call test (order, (/ abs ((/ ((/ i, i, -i * 2 /), i = 1, order) /)) /))
  end subroutine build

  subroutine test (order, values)
    integer, dimension (3:) :: values
    integer :: order, i

    if (size (values, dim = 1) .ne. order * 3) STOP 1
    do i = 1, order
      if (values (i * 3) .ne. i) STOP 2
      if (values (i * 3 + 1) .ne. i) STOP 3
      if (values (i * 3 + 2) .ne. i * 2) STOP 4
    end do
  end subroutine test
end program main