diff mbox

[hsa] Fix static local variable name conflict

Message ID 20151125155737.GO6879@virgil.suse.cz
State New
Headers show

Commit Message

Martin Jambor Nov. 25, 2015, 3:57 p.m. UTC
Hi,

the patch below makes libgomp/testsuite/libgomp.c/target-28.c pass on
HSA, where it previously did not like the two static variables with
the same name.  Committed to the branch. 

Thanks,

Martin


2015-11-25  Martin Jambor  <mjambor@suse.cz>

	* hsa.c (hsa_get_declaration_name): Return ASM name for global
	variables.

---
 gcc/hsa.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox

Patch

diff --git a/gcc/hsa.c b/gcc/hsa.c
index 7c9e0f6..8ab5da7 100644
--- a/gcc/hsa.c
+++ b/gcc/hsa.c
@@ -700,6 +700,8 @@  hsa_get_declaration_name (tree decl)
     }
   else if (TREE_CODE (decl) == FUNCTION_DECL)
     return cgraph_node::get_create (decl)->asm_name ();
+  else if (TREE_CODE (decl) == VAR_DECL && is_global_var (decl))
+    return IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
   else
     return IDENTIFIER_POINTER (DECL_NAME (decl));