From 360ca05451bc04b337dafba99460472f5aebdc3e Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Tue, 29 Mar 2005 14:08:54 +0200 Subject: [PATCH] re PR middle-end/20263 (Incorrect asm for global register vars) PR middle-end/20263 * varasm.c (make_decl_rtl) [ASM_DECLARE_REGISTER_GLOBAL]: Use the DECL_NAME, not the DECL_ASSEMBLER_NAME. From-SVN: r97157 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.dg/sparc-reg-1.c | 11 +++++++++++ gcc/varasm.c | 2 +- 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/sparc-reg-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ef0ccbffbb4..cc7dedd3c24 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2005-03-29 Eric Botcazou + + PR middle-end/20263 + * varasm.c (make_decl_rtl) [ASM_DECLARE_REGISTER_GLOBAL]: Use + the DECL_NAME, not the DECL_ASSEMBLER_NAME. + 2005-03-29 Dale Johannesen * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 73aa6eb1e10..6ba4ac90b8d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2005-03-29 Eric Botcazou + + * gcc.dg/sparc-reg-1.c: New test. + 2005-03-28 Steve Ellcey PR target/19890 diff --git a/gcc/testsuite/gcc.dg/sparc-reg-1.c b/gcc/testsuite/gcc.dg/sparc-reg-1.c new file mode 100644 index 00000000000..860094299a1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/sparc-reg-1.c @@ -0,0 +1,11 @@ +/* PR middle-end/20263 */ + +/* { dg-do assemble { target sparc64-*-* } } */ +/* { dg-options "" } */ + +register void *tp __asm__("%g7"); + +void set_tp(void) +{ + tp = 0; +} diff --git a/gcc/varasm.c b/gcc/varasm.c index c174eb41414..751c8bce959 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -897,7 +897,6 @@ make_decl_rtl (tree decl) name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); - if (TREE_CODE (decl) != FUNCTION_DECL && DECL_REGISTER (decl)) { reg_number = decode_reg_name (name); @@ -940,6 +939,7 @@ make_decl_rtl (tree decl) /* Make this register global, so not usable for anything else. */ #ifdef ASM_DECLARE_REGISTER_GLOBAL + name = IDENTIFIER_POINTER (DECL_NAME (decl)); ASM_DECLARE_REGISTER_GLOBAL (asm_out_file, decl, reg_number, name); #endif nregs = hard_regno_nregs[reg_number][DECL_MODE (decl)];