================
@@ -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)
----------------
eugeneepshteyn wrote:

Please also add test cases where trampolines are not just used at the top level 
block of procedure, but also used inside `if` or `do` loop.

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