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