This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by atmnpatel on Jan 31 2021, 4:47 PM.

Details

Summary

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.

It seems to me that the latest libstdc++ reads PM->RTLs and knows to move
PM->RTLs, while earlier implementations try to copy it, but this seems to fix
it for me at least locally, but given how finicky this could be, it'd be great
if @sylvestre.ledru could confirm it for me. The alternative is to change the
LoadRTLs signature but this should be fine.

Diff Detail

Event Timeline

atmnpatel created this revision.Jan 31 2021, 4:47 PM
atmnpatel requested review of this revision.Jan 31 2021, 4:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 31 2021, 4:47 PM
jdoerfert accepted this revision.Jan 31 2021, 11:06 PM

LG. Should hopefully fix the issue. Please also backport to the release branch.

This revision is now accepted and ready to land.Jan 31 2021, 11:06 PM

I confirm that it fixed the problem - still occurring on 12

Sorry I added it to the bug assuming that I couldn't actually push to the 12.x release branch, but I do have permission for that so it should be fixed there now as well.