brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 86ddeb9 Raw
29 lines · plain
1! RUN: bbc -emit-hlfir %s -o - | FileCheck %s2 3! Check that the lowering does not generate fir.box_addr for4! the optional box. It will cause segfault during execution.5 6! CHECK-LABEL:   func.func @_QPtest(7! CHECK-SAME:        %[[VAL_0:.*]]: !fir.box<!fir.array<?xi32>> {fir.bindc_name = "ext_buf", fir.contiguous, fir.optional}) {8! CHECK:           %[[VAL_1:.*]]:2 = hlfir.declare %[[VAL_0]] dummy_scope %{{[0-9]+}} arg {{[0-9]+}} {fortran_attrs = #fir.var_attrs<contiguous, optional>, uniq_name = "_QFtestEext_buf"} : (!fir.box<!fir.array<?xi32>>, !fir.dscope) -> (!fir.box<!fir.array<?xi32>>, !fir.box<!fir.array<?xi32>>)9! CHECK:           %[[VAL_2:.*]] = fir.is_present %[[VAL_1]]#1 : (!fir.box<!fir.array<?xi32>>) -> i110! CHECK:           cf.cond_br %[[VAL_2]], ^bb1, ^bb211! CHECK:         ^bb1:12! CHECK:           %[[VAL_3:.*]] = arith.constant 0 : i3213! CHECK:           %[[VAL_4:.*]] = arith.constant false14! CHECK:           %[[VAL_5:.*]] = arith.constant false15! CHECK:           fir.call @_FortranAStopStatement(%[[VAL_3]], %[[VAL_4]], %[[VAL_5]]) fastmath<contract> : (i32, i1, i1) -> ()16! CHECK:           fir.unreachable17! CHECK:         ^bb2:18! CHECK:           cf.br ^bb319! CHECK:         ^bb3:20! CHECK:           return21! CHECK:         }22subroutine test(ext_buf)23  integer, contiguous, optional :: ext_buf(:)24  if (present(ext_buf)) then25     stop26  endif27  return28end subroutine test29