]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
For nvptx offloading, make sure to emit C++ constructor, destructor aliases [PR97106]
authorThomas Schwinge <tschwinge@baylibre.com>
Wed, 16 Apr 2025 12:00:31 +0000 (14:00 +0200)
committerThomas Schwinge <tschwinge@baylibre.com>
Wed, 16 Apr 2025 14:03:04 +0000 (16:03 +0200)
PR target/97106
gcc/
* config/nvptx/nvptx.cc (nvptx_asm_output_def_from_decls)
[ACCEL_COMPILER]: Make sure to emit C++ constructor, destructor
aliases.
libgomp/
* testsuite/libgomp.c++/pr96390.C: Un-XFAIL nvptx offloading.
* testsuite/libgomp.c-c++-common/pr96390.c: Adjust.

gcc/config/nvptx/nvptx.cc
libgomp/testsuite/libgomp.c++/pr96390.C
libgomp/testsuite/libgomp.c-c++-common/pr96390.c

index 28da43ca740b048b1960bc0708507bf8a4c56ae6..d1e25b99701c3e3573cf1782ba0537013754d601 100644 (file)
@@ -7789,6 +7789,18 @@ nvptx_asm_output_def_from_decls (FILE *stream, tree name,
 #endif
 
   cgraph_node *cnode = cgraph_node::get (name);
+#ifdef ACCEL_COMPILER
+  /* For nvptx offloading, make sure to emit C++ constructor, destructor aliases [PR97106]
+
+     For some reason (yet to be analyzed), they're not 'cnode->referred_to_p ()'.
+     (..., or that's not the right approach at all;
+     <https://inbox.sourceware.org/87v7rx8lbx.fsf@euler.schwinge.ddns.net>
+     "Re: [committed][nvptx] Use .alias directive for mptx >= 6.3").  */
+  if (DECL_CXX_CONSTRUCTOR_P (name)
+      || DECL_CXX_DESTRUCTOR_P (name))
+    ;
+  else
+#endif
   if (!cnode->referred_to_p ())
     /* Prevent "Internal error: reference to deleted section".  */
     return;
index 1f3c3e056618de92c4c3656084ac08925b91cee3..be1960186eaadf8d6acd5245d7f8f3dd045e959c 100644 (file)
@@ -1,6 +1,4 @@
 /* { dg-additional-options "-O0 -fdump-tree-omplower" } */
-/* { dg-additional-options "-foffload=-Wa,--verify" { target offload_target_nvptx } } */
-/* { dg-xfail-if "PR 97106/PR 97102 - .alias not (yet) supported for nvptx" { offload_target_nvptx } } */
 
 #include <cstdlib>
 #include <type_traits>
index b89f934811a5fb0eb9363632a1f13ee8a5cbbf82..ca7865d322df70fdd7ef3b27c3742dc798e51a5e 100644 (file)
@@ -1,7 +1,7 @@
 /* { dg-additional-options "-O0 -fdump-tree-omplower" } */
 /* { dg-additional-options "-foffload=-Wa,--verify" { target offload_target_nvptx } } */
 /* { dg-require-alias "" } */
-/* { dg-xfail-if "PR 97102/PR 97106 - .alias not (yet) supported for nvptx" { offload_target_nvptx } } */
+/* { dg-xfail-if PR105018 { offload_target_nvptx } } */
 
 #ifdef __cplusplus
 extern "C" {