diff options
author | Kazu Hirata <kazu@hxi.com> | 2001-11-01 15:40:09 +0000 |
---|---|---|
committer | Kazu Hirata <kazu@gcc.gnu.org> | 2001-11-01 15:40:09 +0000 |
commit | 93cacb72d049165e92864ef505cf2f936cc33af3 (patch) | |
tree | c89e243cc4084c91e0c3653ad9127d7f598a314e | |
parent | b522a9ce44f428196739394a69ab9b78418b80ba (diff) | |
download | gcc-93cacb72d049165e92864ef505cf2f936cc33af3.zip gcc-93cacb72d049165e92864ef505cf2f936cc33af3.tar.gz gcc-93cacb72d049165e92864ef505cf2f936cc33af3.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/config/h8300/h8300.c | 10 |
2 files changed, 10 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 55f5d46..45a62d0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 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. * config/m68k/3b1g.h: Likewise. * config/m68k/a-ux.h: Likewise. diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index c713f52..0d5fffb 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 * |