aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/mmix/mmix.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/mmix/mmix.c')
-rw-r--r--gcc/config/mmix/mmix.c9
1 files changed, 3 insertions, 6 deletions
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