Commit 4d16a7b7 by Jan Hubicka Committed by Jan Hubicka

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
parent f4c91e0d
2008-07-13 Jan Hubicka <jh@suse.cz>
* tree.c (decl_assembler_name_equal): Expect assembler name of decl
to be mangled too.
2008-07-13 Richard Guenther <rguenther@suse.de> 2008-07-13 Richard Guenther <rguenther@suse.de>
PR middle-end/36811 PR middle-end/36811
......
...@@ -350,32 +350,53 @@ bool ...@@ -350,32 +350,53 @@ bool
decl_assembler_name_equal (tree decl, const_tree asmname) decl_assembler_name_equal (tree decl, const_tree asmname)
{ {
tree decl_asmname = DECL_ASSEMBLER_NAME (decl); tree decl_asmname = DECL_ASSEMBLER_NAME (decl);
const char *decl_str;
const char *asmname_str;
bool test = false;
if (decl_asmname == asmname) if (decl_asmname == asmname)
return true; 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. /* 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 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 is the correct thing to do with -fleading-underscore. Arguably, we've
historically been doing the wrong thing in assemble_alias by always historically been doing the wrong thing in assemble_alias by always
printing the leading underscore. Since we're not changing that, make printing the leading underscore. Since we're not changing that, make
sure user_label_prefix follows the '*' before matching. */ 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); size_t ulp_len = strlen (user_label_prefix);
decl_str ++;
if (ulp_len == 0) if (ulp_len == 0)
; test = true;
else if (strncmp (decl_str, user_label_prefix, ulp_len) == 0) else if (strncmp (decl_str, user_label_prefix, ulp_len) == 0)
decl_str += ulp_len; decl_str += ulp_len, test=true;
else 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 --;
} }
if (!test)
return false; return false;
return strcmp (decl_str, asmname_str) == 0;
} }
/* Hash asmnames ignoring the user specified marks. */ /* Hash asmnames ignoring the user specified marks. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment