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/block_name_2.f90 | 60 ++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/block_name_2.f90 (limited to 'gcc/testsuite/gfortran.dg/block_name_2.f90') diff --git a/gcc/testsuite/gfortran.dg/block_name_2.f90 b/gcc/testsuite/gfortran.dg/block_name_2.f90 new file mode 100644 index 000000000..d86e77e7a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/block_name_2.f90 @@ -0,0 +1,60 @@ +! { dg-do compile } +! Test that various illegal combinations of block statements with +! block names yield the correct error messages. Motivated by PR31471. +program blocks + dimension a(5,2) + + a = 0 + + ! The END statement of a labelled block needs to carry the construct + ! name. + d1: do i=1,10 + end do ! { dg-error "Expected block name of .... in END DO statement" } + end do d1 + + i1: if (i > 0) then + end if ! { dg-error "Expected block name of .... in END IF statement" } + end if i1 + + s1: select case (i) + end select ! { dg-error "Expected block name of .... in END SELECT statement" } + end select s1 + + w1: where (a > 0) + end where ! { dg-error "Expected block name of .... in END WHERE statement" } + end where w1 + + f1: forall (i = 1:10) + end forall ! { dg-error "Expected block name of .... in END FORALL statement" } + end forall f1 + + ! A construct name may not appear in the END statement, if it + ! doesn't appear in the statement beginning the block. + ! Likewise it may not appear in ELSE IF, ELSE, ELSEWHERE or CASE + ! statements. + do i=1,10 + end do d2 ! { dg-error "Syntax error in END DO statement" } + end do + + if (i > 0) then + else if (i ==0) then i2 ! { dg-error "Unexpected junk after ELSE IF statement" } + else i2 ! { dg-error "Unexpected junk after ELSE statement" } + end if i2 ! { dg-error "Syntax error in END IF statement" } + end if + + select case (i) + case (1) s2 ! { dg-error "Syntax error in CASE specification" } + case default s2 ! { dg-error "Syntax error in CASE specification" } + end select s2 ! { dg-error "Syntax error in END SELECT statement" } + end select + + where (a > 0) + elsewhere w2 ! { dg-error "Unexpected junk after ELSE statement" } + end where w2 ! { dg-error "Syntax error in END WHERE statement" } + end where + + forall (i=1:10) + end forall f2 ! { dg-error "Syntax error in END FORALL statement" } + end forall + +end program blocks -- cgit v1.2.3