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

! { dg-do run }
!
! PR fortran/59026
!
! Contributed by F-X Coudert  <fxcoudert@gcc.gnu.org>
!
! Failed to dereference the argument in scalarized loop.
!
elemental integer function foo(x)
  integer, value :: x
  foo = x + 1
end function

  interface
    elemental integer function foo(x)
    integer, value :: x
    end function
  end interface

  if (foo(42) .ne. 43) STOP 1
  if (any (foo([0,1]) .ne. [1,2])) STOP 2
end