Commit 354e99ce by Alexandre Petit-Bianco Committed by Alexandre Petit-Bianco

parse.y (do_merge_string_cste): New locals.

2000-08-11  Alexandre Petit-Bianco  <apbianco@cygnus.com>

	* parse.y (do_merge_string_cste): New locals. Create new
	STRING_CSTs each time, use memcpy. Fixes gcj/311

(Fixes gcj/311:
   http://gcc.gnu.org/ml/gcc-patches/2000-09/msg00144.html
   http://sources.redhat.com/ml/java-prs/2000-q3/msg00116.html)

From-SVN: r36176
parent 3ca8c9ae
...@@ -6,6 +6,11 @@ ...@@ -6,6 +6,11 @@
compression_method fields. compression_method fields.
* zextract.c (read_zip_archive): Collect file compression info. * zextract.c (read_zip_archive): Collect file compression info.
2000-08-11 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (do_merge_string_cste): New locals. Create new
STRING_CSTs each time, use memcpy. Fixes gcj/311.
2000-08-07 Hans Boehm <boehm@acm.org> 2000-08-07 Hans Boehm <boehm@acm.org>
* boehm.c (mark_reference_fields): Set marking bits for all words in * boehm.c (mark_reference_fields): Set marking bits for all words in
......
...@@ -12892,20 +12892,26 @@ do_merge_string_cste (cste, string, string_len, after) ...@@ -12892,20 +12892,26 @@ do_merge_string_cste (cste, string, string_len, after)
const char *string; const char *string;
int string_len, after; int string_len, after;
{ {
int len = TREE_STRING_LENGTH (cste) + string_len;
const char *old = TREE_STRING_POINTER (cste); const char *old = TREE_STRING_POINTER (cste);
int old_len = TREE_STRING_LENGTH (cste);
int len = old_len + string_len;
char *new;
cste = make_node (STRING_CST);
TREE_STRING_LENGTH (cste) = len; TREE_STRING_LENGTH (cste) = len;
TREE_STRING_POINTER (cste) = obstack_alloc (expression_obstack, len+1); new = TREE_STRING_POINTER (cste) = obstack_alloc (expression_obstack, len+1);
if (after) if (after)
{ {
strcpy (TREE_STRING_POINTER (cste), string); memcpy (new, string, string_len);
strcat (TREE_STRING_POINTER (cste), old); memcpy (&new [string_len], old, old_len);
} }
else else
{ {
strcpy (TREE_STRING_POINTER (cste), old); memcpy (new, old, old_len);
strcat (TREE_STRING_POINTER (cste), string); memcpy (&new [old_len], string, string_len);
} }
new [len] = '\0';
return cste; return cste;
} }
......
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