https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83046
--- Comment #4 from Thomas Schwinge <tschwinge at gcc dot gnu.org> --- (In reply to Martin Liška from comment #3) > (In reply to Thomas Schwinge from comment #0) > > ... starting with r254437 "Instrument function exit with > > __builtin_unreachable in C++". > > Obviously, that test case has a "-Wreturn-type mismatch" (which is not > > diagnosed for C++; see reduced PR83045), and fixing that cures this nvptx > > offloading ICE. > > Can you please provide steps to reproduce this? You'll either have to build an offloading compiler, but -- much simpler! -- I assume it will be sufficient to resolve the issue seen in the "-foffload=disable" case: Configure GCC as usual, but add "--enable-offload-targets=nvptx-none=/no/where" (to generally enable offloading, but without providing an actual nvptx offloading compiler), build, and then run: $ make check-target-libgomp RUNTESTFLAGS='--target_board=unix\{-foffload=disable\} {c,c++}.exp=gang-static-2.c' [...] Running target unix/-foffload=disable Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target. Using /usr/share/dejagnu/config/unix.exp as generic interface file for target. Using ../../../../source-gcc/libgomp/testsuite/config/default.exp as tool-and-target-specific interface file. Running ../../../../source-gcc/libgomp/testsuite/libgomp.c/c.exp ... Running ../../../../source-gcc/libgomp/testsuite/libgomp.c++/c++.exp ... Running ../../../../source-gcc/libgomp/testsuite/libgomp.hsa.c/c.exp ... Running ../../../../source-gcc/libgomp/testsuite/libgomp.oacc-c/c.exp ... FAIL: libgomp.oacc-c/../libgomp.oacc-c-c++-common/gang-static-2.c -DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -O2 execution test Running ../../../../source-gcc/libgomp/testsuite/libgomp.oacc-c++/c++.exp ... FAIL: libgomp.oacc-c++/../libgomp.oacc-c-c++-common/gang-static-2.c -DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 -O2 (test for excess errors) === libgomp Summary === # of expected passes 1 # of unexpected failures 2 # of unresolved testcases 1 # of unsupported tests 4 [...] Compilation should either succeed (as it still does for C, and did before for C++), or terminate with a suitable diagnostic (the issue discussed in PR83045 "-Wreturn-type regression in C++"). For "c.exp" the "execution test" FAILs: "libgomp: target function wasn't mapped" (expected in this special configuration), but for c++.exp you'll see compilation FAIL with "excess errors": /tmp/ccBzwk9H.o:(.gnu.offload_funcs+0x0): undefined reference to `main._omp_fn.7' /tmp/ccBzwk9H.o:(.gnu.offload_funcs+0x8): undefined reference to `main._omp_fn.6' /tmp/ccBzwk9H.o:(.gnu.offload_funcs+0x10): undefined reference to `main._omp_fn.5' /tmp/ccBzwk9H.o:(.gnu.offload_funcs+0x18): undefined reference to `main._omp_fn.4' /tmp/ccBzwk9H.o:(.gnu.offload_funcs+0x20): undefined reference to `main._omp_fn.3' /tmp/ccBzwk9H.o:(.gnu.offload_funcs+0x28): undefined reference to `main._omp_fn.2' /tmp/ccBzwk9H.o:(.gnu.offload_funcs+0x30): undefined reference to `main._omp_fn.1' collect2: error: ld returned 1 exit status compiler exited with status 1 (I'll probably not be able to look into that myself in the next few weeks.)