[llvm-branch-commits] [openmp] c0097c7 - [OpenMP][Libomptarget] Remove possible harmful copy constructor call for RTLsTy

Atmn Patel via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Feb 2 19:05:27 PST 2021


Author: Atmn Patel
Date: 2021-02-02T22:04:20-05:00
New Revision: c0097c784179e6f927ed8ae6b28796faee2fea61

URL: https://github.com/llvm/llvm-project/commit/c0097c784179e6f927ed8ae6b28796faee2fea61
DIFF: https://github.com/llvm/llvm-project/commit/c0097c784179e6f927ed8ae6b28796faee2fea61.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 239570935cb2..cf6d36960c75 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 llvm-branch-commits mailing list