Error using atomic variables when OpenACC and LTO/IPA are enabled


I wanted to port some code to nvc++ with the intent to speedup some hot loops. I decided to simply switch the compiler I inputted to CMake. Most of it went fine modulo some minor changes (tests OK, no significant perf regression).

I then enabled the OpenACC switch, everything went fine. Later when I enabled LTO using the -Mipa=fast,inline/-Mipa=fast/-Mipa=inline and faced a compiler error triggered in the presence of atomic variables (std::atomic).

NVC+±S-0000-Internal compiler error. accel.c::acc_remove_atomics: ILI_ALT is missing for atomicrmw opcode 326 ( 326)
NVC++/x86-64 Linux 22.1-0: compilation completed with severe errors

Here is an example code that triggers the “crash”.

#include <atomic>

int main() {
  std::atomic<unsigned> an_atomic_;
  return 0;

Compiled using:

nvc++ -acc -Mipa=fast

the following commands do not trigger the error.

nvc++ -acc
nvc++ -Mipa=fast

I get the error only when acc and ipa are enabled together .

I’m looking for a workaround else than disabling ipa.

Hi EtienneM,

We actually disabled IPA support awhile ago, when we moved to using a LLVM back-end. We left the flags in since we are in the process of adding it back, but you should have seen the same message as you do without the “-acc” flag. The ICE is unexpected so I added a problem report, TPR #31183, and will have our engineers investigate.

This is what you should have seen:

% nvc++ -Mipa=fast
Warning: IPA optimizations not supported for this target
Linking without IPA

I’m looking for a workaround else than disabling ipa.

Sorry, but disabling the “-Mipa” flag is the only option.