[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
This commit is contained in:
Atmn Patel 2021-01-31 19:18:41 -05:00
parent 46e764a628
commit b545667d0a
1 changed files with 1 additions and 1 deletions

View File

@ -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) {