view gcc/testsuite/gfortran.dg/pr71523_2.f90 @ 128:fe568345ddd5

fix CbC-example
author mir3636
date Wed, 11 Apr 2018 19:32:28 +0900
parents 04ced10e8804
children 84e7813d76e9
line wrap: on
line source

! PR Fortran/71523
!
! { dg-do run }
! { dg-options "-finit-integer=12345 -fautomatic -fmax-stack-var-size=8" }
!
! Make sure that variables larger than max-stack-var-size become
! static and are given the correct _static_ initializer.
!

function set(idx, val)
  implicit none
  integer, intent(in) :: idx, val
  integer set
  integer arr(100)

  set = arr(idx)
  arr(idx) = val
  return
end function

  integer set, val

  val = set(1, 5)
  if (val .ne. 12345) then
    call abort()
  endif

  val = set(1, 10)
  if (val .ne. 5) then
    call abort()
  endif

  val = set(1, 100)
  if (val .ne. 10) then
    call abort()
  endif

end