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>
PR target/34155
......@@ -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
......
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