Commit d26d1cea by Tom Tromey Committed by Hans-Peter Nilsson

mmix.c (mmix_encode_section_info): Use alloca to avoid writing into string…

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
parent 9aee0967
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> 2007-11-21 Kaz Kojima <kkojima@gcc.gnu.org>
PR target/34155 PR target/34155
...@@ -1158,14 +1158,11 @@ mmix_encode_section_info (tree decl, rtx rtl, int first) ...@@ -1158,14 +1158,11 @@ mmix_encode_section_info (tree decl, rtx rtl, int first)
const char *str = XSTR (XEXP (rtl, 0), 0); const char *str = XSTR (XEXP (rtl, 0), 0);
int len = strlen (str); int len = strlen (str);
char *newstr; char *newstr = alloca (len + 2);
newstr[0] = '@';
/* Why is the return type of ggc_alloc_string const? */
newstr = CONST_CAST (char *, ggc_alloc_string ("", len + 1));
strcpy (newstr + 1, str); strcpy (newstr + 1, str);
*newstr = '@'; *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 /* Set SYMBOL_REF_FLAG for things that we want to access with GETA. We
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment