view gcc/testsuite/gfortran.dg/block_7.f08 @ 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 }
! { dg-options "-std=f2008 " }

! Check for correct placement (on the stack) of local variables with BLOCK
! and recursive container procedures.

RECURSIVE SUBROUTINE myproc (i)
  INTEGER, INTENT(IN) :: i
  ! Wrap the block up in some other construct so we see this doesn't mess
  ! things up, either.
  DO
    BLOCK
      INTEGER :: x
      x = i
      IF (i > 0) CALL myproc (i - 1)
      IF (x /= i) STOP 1
    END BLOCK
    EXIT
  END DO
END SUBROUTINE myproc

PROGRAM main
  CALL myproc (42)
END PROGRAM main