diff options
author | Tom Tromey <tromey@redhat.com> | 2007-11-22 07:34:10 +0000 |
---|---|---|
committer | Hans-Peter Nilsson <hp@gcc.gnu.org> | 2007-11-22 07:34:10 +0000 |
commit | d26d1cea50055e4bae9192bef57bc4d5277ddd4f (patch) | |
tree | 5c02964e9e111db62172977fb78c1b009b924b3a | |
parent | 9aee0967b4328b45352b480aac63a80423d4ccf0 (diff) | |
download | gcc-d26d1cea50055e4bae9192bef57bc4d5277ddd4f.zip gcc-d26d1cea50055e4bae9192bef57bc4d5277ddd4f.tar.gz gcc-d26d1cea50055e4bae9192bef57bc4d5277ddd4f.tar.bz2 |
mmix.c (mmix_encode_section_info): Use alloca to avoid writing into string allocated by ggc_alloc_string.
* config/mmix/mmix.c (mmix_encode_section_info): Use alloca to
avoid writing into string allocated by ggc_alloc_string.
From-SVN: r130342
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/config/mmix/mmix.c | 9 |
2 files changed, 8 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b128a5a..ac51ad5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2007-11-22 Tom Tromey <tromey@redhat.com> + + * config/mmix/mmix.c (mmix_encode_section_info): Use alloca to + avoid writing into string allocated by ggc_alloc_string. + 2007-11-21 Kaz Kojima <kkojima@gcc.gnu.org> PR target/34155 diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c index a55b0dc..271b3d2 100644 --- a/gcc/config/mmix/mmix.c +++ b/gcc/config/mmix/mmix.c @@ -1158,14 +1158,11 @@ mmix_encode_section_info (tree decl, rtx rtl, int first) const char *str = XSTR (XEXP (rtl, 0), 0); int len = strlen (str); - char *newstr; - - /* Why is the return type of ggc_alloc_string const? */ - newstr = CONST_CAST (char *, ggc_alloc_string ("", len + 1)); - + char *newstr = alloca (len + 2); + newstr[0] = '@'; strcpy (newstr + 1, str); *newstr = '@'; - XSTR (XEXP (rtl, 0), 0) = newstr; + XSTR (XEXP (rtl, 0), 0) = ggc_alloc_string (newstr, len + 1); } /* Set SYMBOL_REF_FLAG for things that we want to access with GETA. We |