blob: d86e77e7a8c93b93fa6855453c80282b1cd7d843 (
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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
|