h8300.c (h8300_encode_label): Compute a string before passing it to ggc_alloc_string.

* config/h8300/h8300.c (h8300_encode_label): Compute a string
	before passing it to ggc_alloc_string.

From-SVN: r46695
This commit is contained in:
Kazu Hirata 2001-11-01 15:40:09 +00:00 committed by Kazu Hirata
parent b522a9ce44
commit 93cacb72d0
2 changed files with 10 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2001-11-01 Kazu Hirata <kazu@hxi.com>
* config/h8300/h8300.c (h8300_encode_label): Compute a string
before passing it to ggc_alloc_string.
2001-11-01 Kazu Hirata <kazu@hxi.com>
* config/m68k/3b1.h: Fix comment formatting.

View File

@ -3108,13 +3108,13 @@ h8300_encode_label (decl)
{
const char *str = XSTR (XEXP (DECL_RTL (decl), 0), 0);
int len = strlen (str);
char *newstr;
char *newstr = alloca (len + 2);
newstr = ggc_alloc_string (NULL, len + 1);
newstr[0] = '&';
strcpy (&newstr[1], str);
strcpy (newstr + 1, str);
*newstr = '&';
XSTR (XEXP (DECL_RTL (decl), 0), 0) = newstr;
XSTR (XEXP (DECL_RTL (decl), 0), 0) =
ggc_alloc_string (newstr, len + 1);
}
const char *