view gcc/testsuite/gfortran.dg/repeat_3.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

! REPEAT intrinsic, test for PR 31304
! We check that REPEAT accepts all kind arguments for NCOPIES
!
! { dg-do run }
program test
  implicit none

  integer(kind=1) i1
  integer(kind=2) i2
  integer(kind=4) i4
  integer(kind=4) i8
  real(kind=8) r
  character(len=2) s1, s2

  i1 = 1 ; i2 = 1 ; i4 = 1 ; i8 = 1
  r = 1
  s1 = '42'
  r = nearest(r,r)

  s2 = repeat(s1,i1)
  if (s2 /= s1) STOP 1
  s2 = repeat(s1,i2)
  if (s2 /= s1) STOP 2
  s2 = repeat(s1,i4)
  if (s2 /= s1) STOP 3
  s2 = repeat(s1,i8)
  if (s2 /= s1) STOP 4

end program test