mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 03:16:37 +00:00

Previously, jumps to labels in constructs from exterior statements would elicit only a warning. Upgrade these to errors unless the branch into the construct would enter into only DO, IF, and SELECT CASE constructs, whose interiors don't scope variables or have other set-up/tear-down semantics. Branches into these "safe" constructs are still errors if they're nested in an unsafe construct that doesn't also enclose the exterior branch statement. Differential Revision: https://reviews.llvm.org/D113310
41 lines
615 B
Fortran
41 lines
615 B
Fortran
! Tests implemented for this standard
|
|
! 11.1.4 - 4 It is permissible to branch to an end-block-stmt only within its
|
|
! Block Construct
|
|
|
|
! RUN: not %flang_fc1 -fsyntax-only %s 2>&1 | FileCheck %s
|
|
! CHECK: Label '20' is in a construct that prevents its use as a branch target here
|
|
|
|
subroutine s1
|
|
block
|
|
goto (10) 1
|
|
10 end block
|
|
|
|
block
|
|
20 end block
|
|
end
|
|
|
|
subroutine s2
|
|
block
|
|
goto (20) 1
|
|
10 end block
|
|
|
|
block
|
|
20 end block
|
|
end
|
|
|
|
subroutine s3
|
|
block
|
|
block
|
|
goto (10) 1
|
|
10 end block
|
|
20 end block
|
|
end
|
|
|
|
subroutine s4
|
|
block
|
|
block
|
|
goto (20) 1
|
|
10 end block
|
|
20 end block
|
|
end
|