2 ! Test that various illegal combinations of block statements with
3 ! block names yield the correct error messages. Motivated by PR31471.
9 ! The END statement of a labelled block needs to carry the construct
12 end do ! { dg-error "Expected block name of .... in END DO statement" }
16 end if ! { dg-error "Expected block name of .... in END IF statement" }
20 end select
! { dg-error "Expected block name of .... in END SELECT statement" }
24 end where
! { dg-error "Expected block name of .... in END WHERE statement" }
28 end forall
! { dg-error "Expected block name of .... in END FORALL statement" }
31 ! A construct name may not appear in the END statement, if it
32 ! doesn't appear in the statement beginning the block.
33 ! Likewise it may not appear in ELSE IF, ELSE, ELSEWHERE or CASE
36 end do d2
! { dg-error "Syntax error in END DO statement" }
40 else if (i
==0) then i2
! { dg-error "Unexpected junk after ELSE IF statement" }
41 else i2
! { dg-error "Unexpected junk after ELSE statement" }
42 end if i2
! { dg-error "Syntax error in END IF statement" }
46 case (1) s2
! { dg-error "Syntax error in CASE specification" }
47 case default s2
! { dg-error "Syntax error in CASE specification" }
48 end select s2
! { dg-error "Syntax error in END SELECT statement" }
52 elsewhere w2
! { dg-error "Unexpected junk after ELSE statement" }
53 end where w2
! { dg-error "Syntax error in END WHERE statement" }
57 end forall f2
! { dg-error "Syntax error in END FORALL statement" }