aboutsummaryrefslogtreecommitdiff
path: root/gcc/java
diff options
context:
space:
mode:
authorAlexandre Petit-Bianco <apbianco@cygnus.com>2000-09-06 02:37:09 +0000
committerAlexandre Petit-Bianco <apbianco@gcc.gnu.org>2000-09-05 19:37:09 -0700
commit354e99ce386a338ed6b7288fdec8b6ca13ce8946 (patch)
tree08f51aed2bdfe897e5ed89fbf8995198cb882e73 /gcc/java
parent3ca8c9aea002945be6cc6164d3eee6e55acc1b67 (diff)
downloadgcc-354e99ce386a338ed6b7288fdec8b6ca13ce8946.zip
gcc-354e99ce386a338ed6b7288fdec8b6ca13ce8946.tar.gz
gcc-354e99ce386a338ed6b7288fdec8b6ca13ce8946.tar.bz2
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
Diffstat (limited to 'gcc/java')
-rw-r--r--gcc/java/ChangeLog5
-rw-r--r--gcc/java/parse.y18
2 files changed, 17 insertions, 6 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index f21e2a0..7fe0183 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -6,6 +6,11 @@
compression_method fields.
* 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>
* boehm.c (mark_reference_fields): Set marking bits for all words in
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index 4676153..d37a7f1b 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -12892,20 +12892,26 @@ do_merge_string_cste (cste, string, string_len, after)
const char *string;
int string_len, after;
{
- int len = TREE_STRING_LENGTH (cste) + string_len;
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_POINTER (cste) = obstack_alloc (expression_obstack, len+1);
+ new = TREE_STRING_POINTER (cste) = obstack_alloc (expression_obstack, len+1);
+
if (after)
{
- strcpy (TREE_STRING_POINTER (cste), string);
- strcat (TREE_STRING_POINTER (cste), old);
+ memcpy (new, string, string_len);
+ memcpy (&new [string_len], old, old_len);
}
else
{
- strcpy (TREE_STRING_POINTER (cste), old);
- strcat (TREE_STRING_POINTER (cste), string);
+ memcpy (new, old, old_len);
+ memcpy (&new [old_len], string, string_len);
}
+ new [len] = '\0';
return cste;
}