My recent commit ffa0ae6eeef3ad15d3f288283e4c477193052f1a "Add 'libgomp.oacc-c-c++-common/static-variable-1.c' [PR84991, PR84992, PR90779]" for 'libgomp.oacc-c' -- so far ;-) -- never but for 'libgomp.oacc-c++' occasionally/"randomly" fails with GCN offloading, for '-O0' and/or '-O2'. It's certainly possible that something's wrong with my verification logic, but in quite some testing why has the failure ever only shown up for the C++ but never the C variant? On the other hand, why is C++ behaving different from C at all? (I haven't spent any time on understanding that.) A few examples of failures with GCN offloading: static-variable-1.exe: [...]/libgomp/testsuite/libgomp.oacc-c++/../libgomp.oacc-c-c++-common/static-variable-1.c:355: void t2(): Assertion `result_1_ == (((var_init_1 + num_gangs_actual_1 * (1 + i)) * (1 + var_init_1 + num_gangs_actual_1 * (1 + i)) / 2) - ((var_init_1 + num_gangs_actual_1 * (0 + i)) * (1 + var_init_1 + num_gangs_actual_1 * (0 + i)) / 2))' failed. static-variable-1.exe: [...]/libgomp/testsuite/libgomp.oacc-c++/../libgomp.oacc-c-c++-common/static-variable-1.c:368: void t2(): Assertion `result_2_ == (((t2_var_init_2 + num_gangs_actual_2 * (1 + i)) * (1 + t2_var_init_2 + num_gangs_actual_2 * (1 + i)) / 2) - ((t2_var_init_2 + num_gangs_actual_2 * (0 + i)) * (1 + t2_var_init_2 + num_gangs_actual_2 * (0 + i)) / 2))' failed. static-variable-1.exe: [...]/libgomp/testsuite/libgomp.oacc-c++/../libgomp.oacc-c-c++-common/static-variable-1.c:381: void t2(): Assertion `result_3_ == (((var_init_3 + num_gangs_actual_3 * (1 + i)) * (1 + var_init_3 + num_gangs_actual_3 * (1 + i)) / 2) - ((var_init_3 + num_gangs_actual_3 * (0 + i)) * (1 + var_init_3 + num_gangs_actual_3 * (0 + i)) / 2))' failed. I've -- so far ;-) -- not seen any failures with nvptx offloading.
At some point, the 'libgomp.oacc-c-c++-common/static-variable-1.c' execution test also started FAILing for C, not just C++, as initially noted above.
With my recent commit r13-6590-gf8332e52a498df480f72303de32ad0751ad899fe "Use 'GOMP_MAP_VARS_TARGET' for OpenACC compute constructs [PR90596]", the frequency of those FAILs has increased to (almost) always.