xref: /llvm-project/flang/test/Lower/assigned-goto.f90 (revision fd922e6ab0b5324cdf36e2646132d802d3a04ce0)
1! RUN: bbc -emit-fir -o - %s | FileCheck %s
2
3  ! CHECK-LABEL: func @_QPnolist
4  subroutine nolist
5    integer L, V
6 11 V = 1
7    ! CHECK: fir.store %c31{{.*}} to %{{.}}
8    assign 31 to L
9    ! CHECK: fir.select %{{.}} : i32 [31, ^bb{{.}}, unit, ^bb{{.}}]
10    ! CHECK: fir.call @_FortranAReportFatalUserError
11    goto L ! no list
12 21 V = 2
13    go to 41
14 31 V = 3
15 41 print*, 3, V
16 end
17
18 ! CHECK-LABEL: func @_QPlist
19 subroutine list
20    integer L, L1, V
21 66 format("Nonsense")
22    assign 66 to L
23    assign 42 to L1
24    ! CHECK: fir.store %c22{{.*}} to %{{.}}
25    assign 22 to L
26 12 V = 100
27    ! CHECK: fir.store %c32{{.*}} to %{{.}}
28    assign 32 to L
29    ! CHECK: fir.select %{{.}} : i32 [22, ^bb{{.}}, 32, ^bb{{.}}, unit, ^bb{{.}}]
30    ! CHECK: fir.call @_FortranAReportFatalUserError
31    goto L (42, 32, 22, 32, 32) ! duplicate labels are allowed
32 22 V = 200
33    go to 42
34 32 V = 300
35 42 print*, 300, V
36 end
37
38    call nolist
39    call list
40 end
41