[flang-commits] [flang] [Flang] Handle %VAL arguments correctly (PR #157186)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Mon Sep 8 03:54:20 PDT 2025


================
@@ -0,0 +1,14 @@
+! RUN: bbc %s -emit-fir -o - | FileCheck %s
+
+program main
+  logical::a1
+  data a1/.true./
+  call sa(%val(a1))
+! CHECK: fir.load %3 : !fir.ref<!fir.logical<4>>
+! CHECK: fir.convert %13 : (!fir.logical<4>) -> i1
+  write(6,*) "a1 = ", a1
+end program main
+
+subroutine sa(x1)
+  logical::x1
+end subroutine sa
----------------
tblah wrote:

Please could you add a second test to make sure that we continue to correctly handle passing %VAL to a VALUE argument. Something like

```
program main
  ...
  call sb(%val(a1))
  ...
contains
  subroutine sb(x1)
    logical, value :: x1
  end subroutine sb
end program main
```

https://github.com/llvm/llvm-project/pull/157186


More information about the flang-commits mailing list