<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/118239>118239</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang] Compilation error of using %VAL for an actual argument
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang,
llvm:ir
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ohno-fj
</td>
</tr>
</table>
<pre>
```
Version of flang : 20.0.0(590f451b60d434b26c634a07125fb05baf461fa0)/AArch64
```
Using `%VAL (which specifies that the actual argument should be passed by value)` for an `actual argument` results in a compilation error (`LLVM IR failed`).
The following are the test program, Flang, Gfortran and ifx compilation/execution result.
snggf047_22.f90:
```fortran
program main
logical::a1
data a1/.true./
call sa(%val(a1))
write(6,*) "a1 = ", a1
end program main
subroutine sa(x1)
logical::x1
end subroutine sa
```
```
$ flang snggf047_22.f90
error: loc("/work/home/ohno/CT/test/fort/tp/reproducerJ/MCS/v3f/snggf047_22.f90":4:3): unsupported types for logical conversion: 'i32' -> '!llvm.ptr'
error: loc("/work/home/ohno/CT/test/fort/tp/reproducerJ/MCS/v3f/snggf047_22.f90":4:3): failed to legalize operation 'fir.convert'
error: Lowering to LLVM IR failed
error: loc("/work/home/ohno/CT/test/fort/tp/reproducerJ/MCS/v3f/snggf047_22.f90":1:1): cannot be converted to LLVM IR: missing `LLVMTranslationDialectInterface` registration for dialect for op: func.func
error: failed to create the LLVM module
$
```
```
$ gfortran snggf047_2.f90; ./a.out
a1 = T
$
```
```
$ ifx snggf047_2.f90; ./a.out
a1 = T
$
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEVU2PpDYQ_TXVl9IgU3x0c-gDOxOijWYvyWSvkYEyeOPGyDY9s_n1kYHRzvQqyt5Wohvb2FXvlateSe_1MDGfofgAxcNBLmG07mzHyd6pL4fW9l_PUIr9EfVndl7bCa1CZeQ0IGQ1kkhEIoBORSVUX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