https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97106

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
With this additionally:
...
diff --git a/gcc/config/nvptx/nvptx.cc b/gcc/config/nvptx/nvptx.cc
index 1a89c1bc77f..2e1a2dad9fe 100644
--- a/gcc/config/nvptx/nvptx.cc
+++ b/gcc/config/nvptx/nvptx.cc
@@ -968,7 +968,8 @@ static void
 write_fn_proto_1 (std::stringstream &s, bool is_defn,
                  const char *name, const_tree decl)
 {
-  write_fn_marker (s, is_defn, TREE_PUBLIC (decl), name);
+  if (lookup_attribute ("alias", DECL_ATTRIBUTES (decl)) == NULL)
+    write_fn_marker (s, is_defn, TREE_PUBLIC (decl), name);

   /* PTX declaration.  */
   if (DECL_EXTERNAL (decl))
...
I get a simplified libgomp/testsuite/libgomp.c-c++-common/pr96390.c to work.

That is, using only one level of alias indirection:
...
  #pragma omp target map(from:n)
    n = bar ();
...

With the original, two level alias indirection I get:
...
libgomp: Link error log ptxas fatal   : Internal error: alias to unknown symbol
...

That seems to be consistent with the ptx manual, which dictates:
...
.alias fAlias, fAliasee;

Identifier fAliasee is a function symbol which must be defined in the same
module as .alias declaration.
...

Reply via email to