diff options
| author | hp <hp@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-11-22 07:34:10 +0000 |
|---|---|---|
| committer | hp <hp@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-11-22 07:34:10 +0000 |
| commit | b948ae2fb33bbb8b6f07e0b5a9ca9c0659a9b3b3 (patch) | |
| tree | 5c02964e9e111db62172977fb78c1b009b924b3a | |
| parent | bc7ec75d518de400a6c1bf0931cd2200515bb82f (diff) | |
| download | ppe42-gcc-b948ae2fb33bbb8b6f07e0b5a9ca9c0659a9b3b3.tar.gz ppe42-gcc-b948ae2fb33bbb8b6f07e0b5a9ca9c0659a9b3b3.zip | |
* config/mmix/mmix.c (mmix_encode_section_info): Use alloca to
avoid writing into string allocated by ggc_alloc_string.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130342 138bc75d-0d04-0410-961f-82ee72b054a4
| -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 b128a5af979..ac51ad54899 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 a55b0dcc7f3..271b3d21a6a 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 |

