[Openmp-commits] [PATCH] D50565: [OMPT] Make omp_control_tool() compliant when called from Fortran programs

Hansang Bae via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Aug 10 09:05:41 PDT 2018


hbae created this revision.
hbae added reviewers: AndreyChurbanov, tlwilmar, jlpeyton.
hbae added a project: OpenMP.

This change fixes an incorrect behavior of the `omp_control_tool` function when
called from Fortran applications.
A tool callback function for this event is supposed to get `NULL` for the third
argument according to the specification, but the current implementation just
passes a garbage value. A possible fix is to use the `OPTIONAL` attribute for the
third argument.


Repository:
  rOMP OpenMP

https://reviews.llvm.org/D50565

Files:
  runtime/src/include/50/omp_lib.f90.var
  runtime/src/include/50/omp_lib.h.var


Index: runtime/src/include/50/omp_lib.h.var
===================================================================
--- runtime/src/include/50/omp_lib.h.var
+++ runtime/src/include/50/omp_lib.h.var
@@ -506,11 +506,12 @@
           integer (kind=omp_lock_hint_kind), value :: hint
         end subroutine omp_init_nest_lock_with_hint
 
-        function omp_control_tool(command, modifier) bind(c)
+        function omp_control_tool(command, modifier, arg) bind(c)
           import
           integer (kind=omp_integer_kind) omp_control_tool
           integer (kind=omp_control_tool_kind), value :: command
           integer (kind=omp_control_tool_kind), value :: modifier
+          integer (kind=kmp_pointer_kind), optional :: arg
         end function omp_control_tool
 
       end interface
Index: runtime/src/include/50/omp_lib.f90.var
===================================================================
--- runtime/src/include/50/omp_lib.f90.var
+++ runtime/src/include/50/omp_lib.f90.var
@@ -531,11 +531,12 @@
             integer (kind=omp_lock_hint_kind), value :: hint
           end subroutine omp_init_nest_lock_with_hint
 
-          function omp_control_tool(command, modifier) bind(c)
+          function omp_control_tool(command, modifier, arg) bind(c)
             use omp_lib_kinds
             integer (kind=omp_integer_kind) omp_control_tool
             integer (kind=omp_control_tool_kind), value :: command
             integer (kind=omp_control_tool_kind), value :: modifier
+            integer (kind=kmp_pointer_kind), optional :: arg
           end function omp_control_tool
 
         end interface


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50565.160116.patch
Type: text/x-patch
Size: 1625 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20180810/e8c20393/attachment.bin>


More information about the Openmp-commits mailing list