================
@@ -0,0 +1,41 @@
+! RUN: %flang -fsafe-trampoline -emit-llvm -S -o - %s | FileCheck %s
+!
+! Test that -fsafe-trampoline generates calls to the runtime
+! trampoline pool instead of stack-based trampolines.
+
+! CHECK: call {{.*}}@_FortranATrampolineInit
+! CHECK: call {{.*}}@_FortranATrampolineAdjust
+! CHECK: call {{.*}}@_FortranATrampolineFree
+
+module other
+  abstract interface
+     function callback()
+       integer :: callback
+     end function callback
+  end interface
+  contains
+  subroutine foo(fptr)
+    procedure(callback), pointer :: fptr
+    print *, fptr()
+  end subroutine foo
+end module other
+
+subroutine host(local)
+  use other
+  integer :: local
+  procedure(callback), pointer :: fptr
+  fptr => callee
+  call foo(fptr)
----------------
Saieiei wrote:

Added two new test subroutines to `safe-trampoline.f90`: `host_in_if` 
(trampoline used inside an `if` block) and `host_in_do_loop` (trampoline used 
inside a `do` loop, with the closure capturing the loop variable). Both verify 
the full Init/Adjust/Free sequence. Latest push: 
[f68d5d0](https://github.com/llvm/llvm-project/compare/c71773aeaf919087e69b6a91b93204f19a4a22ed..f68d5d029cdc468484ea240f55db1ed8433b2b0d).

https://github.com/llvm/llvm-project/pull/183108
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to