<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/64203>64203</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [Flang] Default logical kind not honoured for temporary logicals
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            flang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          kiranchandramohan
      </td>
    </tr>
</table>

<pre>
    The default logical kind is not honoured for temporary logicals.

**Source**
```
subroutine sb
  call xyz(3 < 4)
end subroutine
```

**Parse-Tree post Semantics**
```
flang-new -fc1 -fdebug-dump-parse-tree -fdefault-integer-8 try.f90 -o -
| ExecutionPart -> Block
| | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> CallStmt = 'CALL xyz(.true._4)'
| | | Call
| | | | ProcedureDesignator -> Name = 'xyz'
| | | | ActualArgSpec
| | | | | ActualArg -> Expr = '.true._4'
| | | | | | LT
| | | | | | | Expr = '3_8'
| | | | | | | | LiteralConstant -> IntLiteralConstant = '3'
| | | | | | | Expr = '4_8'
| | | | | | | | LiteralConstant -> IntLiteralConstant = '4'
```

**Source**
```
subroutine sb
  integer :: x
 integer :: y
  call xyz(x < y)
end subroutine
```

**FIR**
```
  flang-new -fc1 -emit-fir -fdefault-integer-8 try1.f90 -o -
  func.func @_QPsb() {
    %0 = fir.alloca !fir.logical<4> {adapt.valuebyref}
    %1 = fir.alloca i64 {bindc_name = "x", uniq_name = "_QFsbEx"}
    %2 = fir.alloca i64 {bindc_name = "y", uniq_name = "_QFsbEy"}
    %3 = fir.load %1 : !fir.ref<i64>
    %4 = fir.load %2 : !fir.ref<i64>
    %5 = arith.cmpi slt, %3, %4 : i64
    %6 = fir.convert %5 : (i1) -> !fir.logical<4>
 fir.store %6 to %0 : !fir.ref<!fir.logical<4>>
    fir.call @_QPxyz(%0) fastmath<contract> : (!fir.ref<!fir.logical<4>>) -> ()
    return
 }
```

Note: Recently we enabled user control of the default logical kind via the `default-integer-8` flag. This was done to match the behaviour of other compilers. https://reviews.llvm.org/D155279
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0Vt9v4jgQ_mvMyyhR4vwgPPBAYZFWWq26275XjjMhvjo2Zzu03F9_sglQKO1VK52Ek9oz830zY3-pmbVioxDnpLgjxWrCBtdpM38WhineMdUY1uuOqUmtm_38sUNosGWDdCD1RnAm4VmoBoQFpR10WunBYAOtNuCw32rDzP7oamOSrEiyGJ_U_x70YDge_h7Xy2T8hakdaqMHJxSCrQ9LAJxJCa_7fwitMiDZEnJCZwcjqgbOMTch3_LfM2MxejSIsNXWwQP2TDnB7ScptZKpTaTwBaKWpxC1DdbDJmqGfhttA57zeH49tCoSyuEGTVSBM_u4nSUQaYhG7OkSvr0iH5zQ6p4ZBxHJvsGd1Pz57PHOa6mVdWbgo_vBxmqJV4YF9xEPrh_nSyZlmJFsBYROl4sfP8ZOxs4MGD-FVtLpJbcfPvT9qh_3RnNsBoMr9KeJOW0ObD9Zj0emQHID1o8FdwOTC7N52CK_7XLhdix6a47o5-Q_oDiOH4-f2w-dPgNnT9V_Yp6whUPDZNgCpsaOf1fuev0I_SXgt8nk_18ybzr3sVr-TK3j8QeSLUi2gNdx_Wp5f0Pcr0Hc-z8V9_r7709yBbgWMvbCRa0wH0k3vdIuQDsoHvsHkDx5-nVva0IrQmdApndHHwBCiyT0uRUmZlJqzoDQ1M_GTyPJlrnfHzK9Yw3bunjH5ID13mBLpqsLpPQaSZS5j6uFaviTOiuOvhJKCV3CoMTfF4anX2tbfwvmK3D6ZfD95-D7G-DZCVxq1hxrWRxb4WvNlqL0jbiIy9_F0S_FFSGOGeG6mPdbAVY6n7JPZXznAcjHvg0sT4Rcqx0ad0TznJVI_QYHOd3cxBHKG6zTBg-ITh-PwVXitzHelhIS8aI4nLGDNDyYz6Nl1vXMdSRbcq2cYdyFzA65fo3pXE51kponNugGo8b5aTd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