[PATCH] D52046: [OMPT] Fix unsafe initialization of ompt_data_t objects.

Jonathan Peyton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 4 07:59:18 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL343785: [OpenMP][OMPT] Fix unsafe initialization of ompt_data_t objects (authored by jlpeyton, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D52046?vs=165315&id=168293#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D52046

Files:
  openmp/trunk/runtime/src/kmp_runtime.cpp


Index: openmp/trunk/runtime/src/kmp_runtime.cpp
===================================================================
--- openmp/trunk/runtime/src/kmp_runtime.cpp
+++ openmp/trunk/runtime/src/kmp_runtime.cpp
@@ -1209,8 +1209,7 @@
 #endif /* OMP_40_ENABLED */
 
 #if OMPT_SUPPORT
-  ompt_data_t ompt_parallel_data;
-  ompt_parallel_data.ptr = NULL;
+  ompt_data_t ompt_parallel_data = ompt_data_none;
   ompt_data_t *implicit_task_data;
   void *codeptr = OMPT_LOAD_RETURN_ADDRESS(global_tid);
   if (ompt_enabled.enabled &&
@@ -1477,8 +1476,7 @@
     master_set_numthreads = master_th->th.th_set_nproc;
 
 #if OMPT_SUPPORT
-    ompt_data_t ompt_parallel_data;
-    ompt_parallel_data.ptr = NULL;
+    ompt_data_t ompt_parallel_data = ompt_data_none;
     ompt_data_t *parent_task_data;
     omp_frame_t *ompt_frame;
     ompt_data_t *implicit_task_data;
@@ -3726,7 +3724,7 @@
     }
     root_thread->th.th_info.ds.ds_gtid = gtid;
 #if OMPT_SUPPORT
-    root_thread->th.ompt_thread_info.thread_data.ptr = NULL;
+    root_thread->th.ompt_thread_info.thread_data = ompt_data_none;
 #endif
     root_thread->th.th_root = root;
     if (__kmp_env_consistency_check) {
@@ -5601,7 +5599,7 @@
   ompt_data_t *thread_data;
   if (ompt_enabled.enabled) {
     thread_data = &(this_thr->th.ompt_thread_info.thread_data);
-    thread_data->ptr = NULL;
+    *thread_data = ompt_data_none;
 
     this_thr->th.ompt_thread_info.state = omp_state_overhead;
     this_thr->th.ompt_thread_info.wait_id = 0;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52046.168293.patch
Type: text/x-patch
Size: 1488 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181004/412bce92/attachment.bin>


More information about the llvm-commits mailing list