[Openmp-commits] [openmp] b545667 - [OpenMP][Libomptarget] Remove possible harmful copy constructor call for RTLsTy

Atmn Patel via Openmp-commits openmp-commits at lists.llvm.org
Mon Feb 1 17:13:42 PST 2021


Author: Atmn Patel
Date: 2021-02-01T20:13:03-05:00
New Revision: b545667d0a4e8d3ca7d4789c3c4004b2816c1b84

URL: https://github.com/llvm/llvm-project/commit/b545667d0a4e8d3ca7d4789c3c4004b2816c1b84
DIFF: https://github.com/llvm/llvm-project/commit/b545667d0a4e8d3ca7d4789c3c4004b2816c1b84.diff

LOG: [OpenMP][Libomptarget] Remove possible harmful copy constructor call for RTLsTy

>From https://bugs.llvm.org/show_bug.cgi?id=48973, we know that
`std::call_once(PM->RTLs.initFlag, &RTLsTy::LoadRTLs, PM->RTLs)` causes compile
time problems in libstdc++v3 5.3.1. This is because there was a defect in the
standard regarding the `call_once` (LWG 2442). This was fixed in libstdc++ soon
thereafter, but there are likely other standard libraries where this will fail.

By matching this function call with the other one, we fix this bug.

Differential Revision: https://reviews.llvm.org/D95769

Added: 
    

Modified: 
    openmp/libomptarget/src/interface.cpp

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/src/interface.cpp b/openmp/libomptarget/src/interface.cpp
index 7ba405fc29fd..01f3715d6bcc 100644
--- a/openmp/libomptarget/src/interface.cpp
+++ b/openmp/libomptarget/src/interface.cpp
@@ -94,7 +94,7 @@ EXTERN void __tgt_register_requires(int64_t flags) {
 /// adds a target shared library to the target execution image
 EXTERN void __tgt_register_lib(__tgt_bin_desc *desc) {
   TIMESCOPE();
-  std::call_once(PM->RTLs.initFlag, &RTLsTy::LoadRTLs, PM->RTLs);
+  std::call_once(PM->RTLs.initFlag, &RTLsTy::LoadRTLs, &PM->RTLs);
   for (auto &RTL : PM->RTLs.AllRTLs) {
     if (RTL.register_lib) {
       if ((*RTL.register_lib)(desc) != OFFLOAD_SUCCESS) {


        


More information about the Openmp-commits mailing list