aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/block_1.f08
blob: a2a67bc2950d6b275e60e6ef0a72e38a0b5a1b7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
! { dg-do run }
! { dg-options "-std=f2008 -fall-intrinsics" }

! Basic Fortran 2008 BLOCK construct test.

PROGRAM main
  IMPLICIT NONE
  INTEGER :: i

  i = 42

  ! Empty block.
  BLOCK
  END BLOCK

  ! Block without local variables but name.
  BLOCK
    IF (i /= 42) CALL abort ()
    i = 5
  END BLOCK
  IF (i /= 5) CALL abort ()

  ! Named block with local variable and nested block.
  myblock: BLOCK
    INTEGER :: i
    i = -1
    BLOCK
      IF (i /= -1) CALL abort ()
      i = -2
    END BLOCK
    IF (i /= -2) CALL abort ()
  END BLOCK myblock ! Matching end-label.
  IF (i /= 5) CALL abort ()
END PROGRAM main