[Bug target/96706] [nvptx] compilation failure of pr89663-1.c

vries at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Aug 19 13:58:16 GMT 2020


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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |nvptx

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Tentative patch:
...
diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c
index 39d0275493a..7ad9ab326d0 100644
--- a/gcc/config/nvptx/nvptx.c
+++ b/gcc/config/nvptx/nvptx.c
@@ -895,12 +895,12 @@ write_fn_proto (std::stringstream &s, bool is_defn,
      NULL in DECL_ARGUMENTS, for builtin functions without another
        declaration.
      So we have to pick the best one we have.  */
-  tree args = TYPE_ARG_TYPES (fntype);
-  bool prototyped = true;
+  tree args = DECL_ARGUMENTS (decl);
+  bool prototyped = false;
   if (!args)
     {
-      args = DECL_ARGUMENTS (decl);
-      prototyped = false;
+      args = TYPE_ARG_TYPES (fntype);
+      prototyped = true;
     }

   for (; args; args = TREE_CHAIN (args), not_atomic_weak_arg--)
@@ -1304,12 +1304,12 @@ nvptx_declare_function_name (FILE *file, const char
*name, const_tree decl)
     argno = write_arg_type (s, 0, argno, ptr_type_node, true);

   /* Declare and initialize incoming arguments.  */
-  tree args = TYPE_ARG_TYPES (fntype);
-  bool prototyped = true;
+  tree args = DECL_ARGUMENTS (decl);
+  bool prototyped = false;
   if (!args)
     {
-      args = DECL_ARGUMENTS (decl);
-      prototyped = false;
+      args = TYPE_ARG_TYPES (fntype);
+      prototyped = true;
     }

   for (; args != NULL_TREE; args = TREE_CHAIN (args))
...


More information about the Gcc-bugs mailing list