From 30513cf6f9c3c62d17944079664808611f7613c1 Mon Sep 17 00:00:00 2001 From: Andrew Pinski Date: Thu, 2 Dec 2004 14:05:50 +0000 Subject: [PATCH] varasm.c (decode_reg_name): Revert change to check for zero length strings. 2004-12-02 Andrew Pinski * varasm.c (decode_reg_name): Revert change to check for zero length strings. (make_decl_rtl): Make sure that we call decode_reg_name only when needed. From-SVN: r91638 --- gcc/ChangeLog | 7 +++++++ gcc/varasm.c | 19 +++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6b4ce0d9796..cd605116ec4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2004-12-02 Andrew Pinski + + * varasm.c (decode_reg_name): Revert change to check for zero + length strings. + (make_decl_rtl): Make sure that we call decode_reg_name only + when needed. + 2004-12-02 Dorit Naishlos PR tree-opt/18716 diff --git a/gcc/varasm.c b/gcc/varasm.c index e4fb1eee1b6..d270701a83b 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -791,7 +791,7 @@ set_user_assembler_name (tree decl, const char *name) int decode_reg_name (const char *asmspec) { - if (asmspec != 0 && strlen (asmspec) != 0) + if (asmspec != 0) { int i; @@ -901,10 +901,10 @@ make_decl_rtl (tree decl) name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); - reg_number = decode_reg_name (name); if (TREE_CODE (decl) != FUNCTION_DECL && DECL_REGISTER (decl)) { + reg_number = decode_reg_name (name); /* First detect errors in declaring global registers. */ if (reg_number == -1) error ("%Jregister name not specified for %qD", decl, decl); @@ -955,12 +955,19 @@ make_decl_rtl (tree decl) return; } } - /* Now handle ordinary static variables and functions (in memory). Also handle vars declared register invalidly. */ - - if (name[0] == '*' && (reg_number >= 0 || reg_number == -3)) - error ("%Jregister name given for non-register variable %qD", decl, decl); + else if (name[0] == '*') + { +#ifdef REGISTER_PREFIX + if (strlen (REGISTER_PREFIX) != 0) + { + reg_number = decode_reg_name (name) + if (reg_number >= 0 || reg_number == -3) + error ("%Jregister name given for non-register variable %qD", decl, decl); + } +#endif + } /* Specifying a section attribute on a variable forces it into a non-.bss section, and thus it cannot be common. */