80 lines · plain
1! RUN: bbc %s -emit-fir -hlfir=false --canonicalize -o - | FileCheck %s2 3! CHECK-LABEL: stop_test4subroutine stop_test()5 ! CHECK-DAG: %[[c0:.*]] = arith.constant 0 : i326 ! CHECK-DAG: %[[false:.*]] = arith.constant false7 ! CHECK: fir.call @_Fortran{{.*}}StopStatement(%[[c0]], %[[false]], %[[false]])8 ! CHECK-NEXT: fir.unreachable9 stop10end subroutine11 12! CHECK-LABEL: stop_code13subroutine stop_code()14 stop 4215 ! CHECK-DAG: %[[c42:.*]] = arith.constant 42 : i3216 ! CHECK-DAG: %[[false:.*]] = arith.constant false17 ! CHECK: fir.call @_Fortran{{.*}}StopStatement(%[[c42]], %[[false]], %[[false]])18 ! CHECK-NEXT: fir.unreachable19end subroutine20 21! CHECK-LABEL: stop_error22subroutine stop_error()23 error stop24 ! CHECK-DAG: %[[c_1:.*]] = arith.constant 1 : i3225 ! CHECK-DAG: %[[true:.*]] = arith.constant true26 ! CHECK-DAG: %[[false:.*]] = arith.constant false27 ! CHECK: fir.call @_Fortran{{.*}}StopStatement(%[[c_1]], %[[true]], %[[false]])28 ! CHECK-NEXT: fir.unreachable29end subroutine30 31! CHECK-LABEL: stop_quiet32subroutine stop_quiet()33 logical :: b34 stop, quiet = b35 ! CHECK-DAG: %[[c0:.*]] = arith.constant 0 : i3236 ! CHECK-DAG: %[[false:.*]] = arith.constant false37 ! CHECK: %[[ALLOCA:.*]] = fir.alloca !fir.logical<4> {bindc_name = "b", uniq_name = "_QFstop_quietEb"}38 ! CHECK: %[[b:.*]] = fir.load %[[ALLOCA]]39 ! CHECK: %[[bi1:.*]] = fir.convert %[[b]] : (!fir.logical<4>) -> i140 ! CHECK: fir.call @_Fortran{{.*}}StopStatement(%[[c0]], %[[false]], %[[bi1]])41 ! CHECK-NEXT: fir.unreachable42end subroutine43 44! CHECK-LABEL: stop_quiet_constant45subroutine stop_quiet_constant()46 stop, quiet = .true.47 ! CHECK-DAG: %[[true:.*]] = arith.constant true48 ! CHECK-DAG: %[[false:.*]] = arith.constant false49 ! CHECK-DAG: %[[c0:.*]] = arith.constant 0 : i3250 ! CHECK: fir.call @_Fortran{{.*}}StopStatement(%[[c0]], %[[false]], %[[true]])51 ! CHECK-NEXT: fir.unreachable52end subroutine53 54! CHECK-LABEL: stop_error_code_quiet55subroutine stop_error_code_quiet(b)56 logical :: b57 error stop 66, quiet = b58 ! CHECK-DAG: %[[c66:.*]] = arith.constant 66 : i3259 ! CHECK-DAG: %[[true:.*]] = arith.constant true60 ! CHECK-DAG: %[[b:.*]] = fir.load %arg061 ! CHECK-DAG: %[[bi1:.*]] = fir.convert %[[b]] : (!fir.logical<4>) -> i162 ! CHECK: fir.call @_Fortran{{.*}}StopStatement(%[[c66]], %[[true]], %[[bi1]])63 ! CHECK-NEXT: fir.unreachable64end subroutine65 66! CHECK-LABEL: stop_char_lit67subroutine stop_char_lit68 ! CHECK-DAG: %[[false:.*]] = arith.constant false69 ! CHECK-DAG: %[[five:.*]] = arith.constant 5 : index70 ! CHECK-DAG: %[[lit:.*]] = fir.address_of(@_QQ{{.*}}) : !fir.ref<!fir.char<1,5>>71 ! CHECK-DAG: %[[buff:.*]] = fir.convert %[[lit]] : (!fir.ref<!fir.char<1,5>>) -> !fir.ref<i8>72 ! CHECK-DAG: %[[len:.*]] = fir.convert %[[five]] : (index) -> i6473 ! CHECK: fir.call @{{.*}}StopStatementText(%[[buff]], %[[len]], %[[false]], %[[false]]) {{.*}}:74 ! CHECK-NEXT: fir.unreachable75 stop 'crash'76end subroutine stop_char_lit77 78! CHECK-DAG: func private @_Fortran{{.*}}StopStatement(i32, i1, i1)79! CHECK-DAG: func private @_Fortran{{.*}}StopStatementText(!fir.ref<i8>, i64, i1, i1)80