rs6000.c (rs6000_encode_section_info): Fix string length calculation and allocation.

2000-11-19  Franz Sirl  <Franz.Sirl-kernel@lauterbach.com>

	* rs6000/rs6000.c (rs6000_encode_section_info): Fix string length
	calculation and allocation.

From-SVN: r37567
This commit is contained in:
Franz Sirl 2000-11-19 18:49:32 +00:00 committed by Franz Sirl
parent e868d863de
commit 88c1e412e8
2 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2000-11-19 Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
* rs6000/rs6000.c (rs6000_encode_section_info): Fix string length
calculation and allocation.
2000-11-19 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* builtins.c (c_getstr): Constify variable.

View File

@ -7621,11 +7621,11 @@ rs6000_encode_section_info (decl)
{
rtx sym_ref = XEXP (DECL_RTL (decl), 0);
size_t len = strlen (XSTR (sym_ref, 0));
char *str = alloca (len + 1);
char *str = alloca (len + 2);
str[0] = '@';
memcpy (str + 1, XSTR (sym_ref, 0), len + 1);
XSTR (sym_ref, 0) = ggc_alloc_string (str, len);
XSTR (sym_ref, 0) = ggc_alloc_string (str, len + 1);
}
}
}