From: Kazu Hirata Date: Thu, 1 Nov 2001 15:40:09 +0000 (+0000) Subject: h8300.c (h8300_encode_label): Compute a string before passing it to ggc_alloc_string. X-Git-Tag: prereleases/libstdc++-3.0.95~1234 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=93cacb72d049165e92864ef505cf2f936cc33af3;p=thirdparty%2Fgcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 55f5d46c1d2e..45a62d047508 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2001-11-01 Kazu Hirata + + * config/h8300/h8300.c (h8300_encode_label): Compute a string + before passing it to ggc_alloc_string. + 2001-11-01 Kazu Hirata * config/m68k/3b1.h: Fix comment formatting. diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index c713f522782a..0d5fffb21f2b 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -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 *