Files
TheRock/compiler/amd-llvm/flang/test/Lower/stop-statement.f90
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

83 lines
3.4 KiB
Fortran

! RUN: bbc -emit-hlfir --canonicalize %s -o - | FileCheck %s
! CHECK-LABEL: func.func @_QPstop_test() {
subroutine stop_test()
! CHECK-DAG: %[[c0:.*]] = arith.constant 0 : i32
! CHECK-DAG: %[[false:.*]] = arith.constant false
! CHECK: fir.call @_Fortran{{.*}}StopStatement(%[[c0]], %[[false]], %[[false]])
! CHECK-NEXT: fir.unreachable
stop
end subroutine
! CHECK-LABEL: func.func @_QPstop_code() {
subroutine stop_code()
stop 42
! CHECK-DAG: %[[c42:.*]] = arith.constant 42 : i32
! CHECK-DAG: %[[false:.*]] = arith.constant false
! CHECK: fir.call @_Fortran{{.*}}StopStatement(%[[c42]], %[[false]], %[[false]])
! CHECK-NEXT: fir.unreachable
end subroutine
! CHECK-LABEL: func.func @_QPstop_error() {
subroutine stop_error()
error stop
! CHECK-DAG: %[[c_1:.*]] = arith.constant 1 : i32
! CHECK-DAG: %[[true:.*]] = arith.constant true
! CHECK-DAG: %[[false:.*]] = arith.constant false
! CHECK: fir.call @_Fortran{{.*}}StopStatement(%[[c_1]], %[[true]], %[[false]])
! CHECK-NEXT: fir.unreachable
end subroutine
! CHECK-LABEL: func.func @_QPstop_quiet() {
subroutine stop_quiet()
logical :: b
stop, quiet = b
! CHECK-DAG: %[[c0:.*]] = arith.constant 0 : i32
! CHECK-DAG: %[[false:.*]] = arith.constant false
! CHECK-DAG: %[[ALLOCA:.*]] = fir.alloca !fir.logical<4> {bindc_name = "b", uniq_name = "_QFstop_quietEb"}
! CHECK-DAG: %[[DECL:.*]]:2 = hlfir.declare %[[ALLOCA]] {uniq_name = "_QFstop_quietEb"} : (!fir.ref<!fir.logical<4>>) -> (!fir.ref<!fir.logical<4>>, !fir.ref<!fir.logical<4>>)
! CHECK: %[[b:.*]] = fir.load %[[DECL]]#0
! CHECK: %[[bi1:.*]] = fir.convert %[[b]] : (!fir.logical<4>) -> i1
! CHECK: fir.call @_Fortran{{.*}}StopStatement(%[[c0]], %[[false]], %[[bi1]])
! CHECK-NEXT: fir.unreachable
end subroutine
! CHECK-LABEL: func.func @_QPstop_quiet_constant() {
subroutine stop_quiet_constant()
stop, quiet = .true.
! CHECK-DAG: %[[true:.*]] = arith.constant true
! CHECK-DAG: %[[false:.*]] = arith.constant false
! CHECK-DAG: %[[c0:.*]] = arith.constant 0 : i32
! CHECK: fir.call @_Fortran{{.*}}StopStatement(%[[c0]], %[[false]], %[[true]])
! CHECK-NEXT: fir.unreachable
end subroutine
! CHECK-LABEL: func.func @_QPstop_error_code_quiet(
subroutine stop_error_code_quiet(b)
logical :: b
error stop 66, quiet = b
! CHECK-DAG: %[[c66:.*]] = arith.constant 66 : i32
! CHECK-DAG: %[[true:.*]] = arith.constant true
! CHECK-DAG: %[[DECL:.*]]:2 = hlfir.declare %arg0 {{.*}}
! CHECK: %[[b:.*]] = fir.load %[[DECL]]#0
! CHECK: %[[bi1:.*]] = fir.convert %[[b]] : (!fir.logical<4>) -> i1
! CHECK: fir.call @_Fortran{{.*}}StopStatement(%[[c66]], %[[true]], %[[bi1]])
! CHECK-NEXT: fir.unreachable
end subroutine
! CHECK-LABEL: func.func @_QPstop_char_lit() {
subroutine stop_char_lit
! CHECK-DAG: %[[false:.*]] = arith.constant false
! CHECK-DAG: %[[five:.*]] = arith.constant 5 : index
! CHECK-DAG: %[[lit:.*]] = fir.address_of(@_QQ{{.*}}) : !fir.ref<!fir.char<1,5>>
! CHECK-DAG: %[[lit_decl:.*]]:2 = hlfir.declare %[[lit]] {{.*}}
! CHECK-DAG: %[[buff:.*]] = fir.convert %[[lit_decl]]#0 : (!fir.ref<!fir.char<1,5>>) -> !fir.ref<i8>
! CHECK-DAG: %[[len:.*]] = fir.convert %[[five]] : (index) -> i64
! CHECK: fir.call @{{.*}}StopStatementText(%[[buff]], %[[len]], %[[false]], %[[false]]) {{.*}}:
! CHECK-NEXT: fir.unreachable
stop 'crash'
end subroutine stop_char_lit
! CHECK-DAG: func.func private @_Fortran{{.*}}StopStatement(i32, i1, i1)
! CHECK-DAG: func.func private @_Fortran{{.*}}StopStatementText(!fir.ref<i8>, i64, i1, i1)