2011-02-15 Tobias Burnus <burnus@net-b.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / exit_4.f08
blob8033efc47c18bc5c283264cc740208867ab8cfc2
1 ! { dg-do compile }
2 ! { dg-options "-std=f2008 -fcoarray=single" }
4 ! PR fortran/44602
5 ! Check for compile-time errors with non-loop EXITs.
7 ! Contributed by Daniel Kraft, d@domob.eu.
9 PROGRAM main
10   IMPLICIT NONE
11   INTEGER :: bar(2)
13   ! Must not exit CRITICAL.
14   mycrit: CRITICAL
15     EXIT mycrit ! { dg-error "leaves CRITICAL" }
16   END CRITICAL mycrit
18   ! CYCLE is only allowed for loops!
19   myblock: BLOCK
20     CYCLE myblock ! { dg-error "is not applicable to non-loop construct 'myblock'" }
21   END BLOCK myblock
23   ! Invalid construct.
24   ! Thanks to Mikael Morin, mikael.morin@sfr.fr.
25   baz: WHERE ([ .true., .true. ])
26     bar = 0
27     EXIT baz ! { dg-error "is not applicable to construct 'baz'" }
28   END WHERE baz
29 END PROGRAM main