lto/lto.c – used $ or . in generated linkptr name
authorTobias Burnus <tobias@codesourcery.com>
Mon, 23 Mar 2020 13:41:58 +0000 (14:41 +0100)
committerTobias Burnus <tobias@codesourcery.com>
Mon, 23 Mar 2020 13:41:58 +0000 (14:41 +0100)
* lto.c (offload_handle_link_vars): Reduce chance of
naming clashes of generated linkptr variable.

gcc/lto/ChangeLog
gcc/lto/lto.c

index 333f2a3d770126c0357f1dc0e0c538db14fe1f8f..b3c2138aaa31adc43bc1e0bb3705661e3fcc575b 100644 (file)
@@ -1,3 +1,8 @@
+2020-01-29  Tobias Burnus  <tobias@codesourcery.com>
+
+       * lto.c (offload_handle_link_vars): Reduce chance of
+       naming clashes of generated linkptr variable.
+
 2020-01-29  Tobias Burnus  <tobias@codesourcery.com>
 
        PR middle-end/94233
index 467b922eedfda50c1d9cf84c2c4cb1cae764de49..cd34d6c9e7a95fdb450ee3ccf5a483f2b0bc97de 100644 (file)
@@ -561,11 +561,9 @@ offload_handle_link_vars (void)
                          DECL_ATTRIBUTES (var->decl)))
       {
        tree type = build_pointer_type (TREE_TYPE (var->decl));
-       tree var_name = DECL_ASSEMBLER_NAME (var->decl);
-       char *new_name
-         = ACONCAT ((IDENTIFIER_POINTER (var_name), "_linkptr", NULL));
        tree link_ptr_var = build_decl (UNKNOWN_LOCATION, VAR_DECL,
-                                       get_identifier (new_name), type);
+                                       clone_function_name (var->decl,
+                                                            "linkptr"), type);
        TREE_USED (link_ptr_var) = 1;
        TREE_STATIC (link_ptr_var) = 1;
        DECL_ARTIFICIAL (link_ptr_var) = 1;