From: Jan Hubicka Date: Sun, 13 Jul 2008 20:55:47 +0000 (+0200) Subject: tree.c (decl_assembler_name_equal): Expect assembler name of decl to be mangled too. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4d16a7b7c29ca46e15e7d8d305b9522addbcdc62;p=gcc.git tree.c (decl_assembler_name_equal): Expect assembler name of decl to be mangled too. * tree.c (decl_assembler_name_equal): Expect assembler name of decl to be mangled too. From-SVN: r137756 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7bc3702b329..4a98d096ee4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2008-07-13 Jan Hubicka + + * tree.c (decl_assembler_name_equal): Expect assembler name of decl + to be mangled too. + 2008-07-13 Richard Guenther PR middle-end/36811 diff --git a/gcc/tree.c b/gcc/tree.c index 81c471b7067..0bb9fd9367f 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -350,32 +350,53 @@ bool decl_assembler_name_equal (tree decl, const_tree asmname) { tree decl_asmname = DECL_ASSEMBLER_NAME (decl); + const char *decl_str; + const char *asmname_str; + bool test = false; if (decl_asmname == asmname) return true; + decl_str = IDENTIFIER_POINTER (decl_asmname); + asmname_str = IDENTIFIER_POINTER (asmname); + + /* If the target assembler name was set by the user, things are trickier. We have a leading '*' to begin with. After that, it's arguable what is the correct thing to do with -fleading-underscore. Arguably, we've historically been doing the wrong thing in assemble_alias by always printing the leading underscore. Since we're not changing that, make sure user_label_prefix follows the '*' before matching. */ - if (IDENTIFIER_POINTER (decl_asmname)[0] == '*') + if (decl_str[0] == '*') { - const char *decl_str = IDENTIFIER_POINTER (decl_asmname) + 1; size_t ulp_len = strlen (user_label_prefix); + decl_str ++; + if (ulp_len == 0) - ; + test = true; else if (strncmp (decl_str, user_label_prefix, ulp_len) == 0) - decl_str += ulp_len; + decl_str += ulp_len, test=true; else - return false; + decl_str --; + } + if (asmname_str[0] == '*') + { + size_t ulp_len = strlen (user_label_prefix); - return strcmp (decl_str, IDENTIFIER_POINTER (asmname)) == 0; + asmname_str ++; + + if (ulp_len == 0) + test = true; + else if (strncmp (asmname_str, user_label_prefix, ulp_len) == 0) + asmname_str += ulp_len, test=true; + else + asmname_str --; } - return false; + if (!test) + return false; + return strcmp (decl_str, asmname_str) == 0; } /* Hash asmnames ignoring the user specified marks. */