1! { dg-do compile }
2! PR 38507
3! Verify that we correctly flag invalid gotos, while not flagging valid gotos.
4integer i,j
5
6do i=1,10
7   goto 20
820 end do   ! { dg-warning "is not in the same block" }
9
10goto 20   ! { dg-warning "is not in the same block" }
11goto 25   ! { dg-warning "is not in the same block" }
12goto 40   ! { dg-warning "is not in the same block" }
13goto 50   ! { dg-warning "is not in the same block" }
14
15goto 222
16goto 333
17goto 444
18
19222 if (i < 0) then
2025 end if      ! { dg-warning "is not in the same block" }
21
22333 if (i > 0) then
23   do j = 1,20
24      goto 30
25   end do
26else if (i == 0) then
27   goto 30
28else
29   goto 30
3030 end if
31
32444 select case(i)
33case(0)
34   goto 50
35   goto 60  ! { dg-warning "is not in the same block" }
36case(1)
37   goto 40
38   goto 50
39   40 continue  ! { dg-warning "is not in the same block" }
40   60 continue    ! { dg-warning "is not in the same block" }
4150 end select   ! { dg-warning "is not in the same block" }
42continue
43
44end
45