From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- gcc/testsuite/gfortran.dg/exit_3.f08 | 88 ++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/exit_3.f08 (limited to 'gcc/testsuite/gfortran.dg/exit_3.f08') diff --git a/gcc/testsuite/gfortran.dg/exit_3.f08 b/gcc/testsuite/gfortran.dg/exit_3.f08 new file mode 100644 index 000000000..732497b6d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/exit_3.f08 @@ -0,0 +1,88 @@ +! { dg-do run } +! { dg-options "-std=f2008 -fall-intrinsics" } + +! PR fortran/44602 +! Check for correct behaviour of EXIT / CYCLE combined with non-loop +! constructs at run-time. + +! Contributed by Daniel Kraft, d@domob.eu. + +PROGRAM main + IMPLICIT NONE + + TYPE :: t + END TYPE t + + INTEGER :: i + CLASS(t), ALLOCATABLE :: var + + ! EXIT and CYCLE without names always refer to innermost *loop*. This + ! however is checked at run-time already in exit_1.f08. + + ! Basic EXITs from different non-loop constructs. + + i = 2 + myif: IF (i == 1) THEN + CALL abort () + EXIT myif + ELSE IF (i == 2) THEN + EXIT myif + CALL abort () + ELSE + CALL abort () + EXIT myif + END IF myif + + mysel: SELECT CASE (i) + CASE (1) + CALL abort () + EXIT mysel + CASE (2) + EXIT mysel + CALL abort () + CASE DEFAULT + CALL abort () + EXIT mysel + END SELECT mysel + + mycharsel: SELECT CASE ("foobar") + CASE ("abc") + CALL abort () + EXIT mycharsel + CASE ("xyz") + CALL abort () + EXIT mycharsel + CASE DEFAULT + EXIT mycharsel + CALL abort () + END SELECT mycharsel + + myblock: BLOCK + EXIT myblock + CALL abort () + END BLOCK myblock + + myassoc: ASSOCIATE (x => 5 + 2) + EXIT myassoc + CALL abort () + END ASSOCIATE myassoc + + ALLOCATE (t :: var) + mytypesel: SELECT TYPE (var) + TYPE IS (t) + EXIT mytypesel + CALL abort () + CLASS DEFAULT + CALL abort () + EXIT mytypesel + END SELECT mytypesel + + ! Check EXIT with nested constructs. + outer: BLOCK + inner: IF (.TRUE.) THEN + EXIT outer + CALL abort () + END IF inner + CALL abort () + END BLOCK outer +END PROGRAM main -- cgit v1.2.3