Fix string concatenation bug.
authorAnthony Green <green@redhat.com>
Tue, 8 Oct 2002 07:10:49 +0000 (07:10 +0000)
committerAnthony Green <green@gcc.gnu.org>
Tue, 8 Oct 2002 07:10:49 +0000 (07:10 +0000)
From-SVN: r57912

gcc/java/ChangeLog
gcc/java/parse.y

index e3f1c69c16e06e26302cc2dad84d76e32351e136..1ef902ca78fba35c304f0c3f4f589a01fc63a4fa 100644 (file)
@@ -1,3 +1,7 @@
+2002-10-07  Anthony Green  <green@redhat.com> 
+
+        * parse.y (merge_string_cste): Fix bug in string concatenation. 
+
 2002-10-03  Michael Koch  <konqueror@gmx.de>
 
        * gcj.texi (Standard properties):
index 217f74cda92e7f562ee05c8e5c0a60f3e6a98779..bb7155bafb6d791340f3ca433767aea81d9b6f33 100644 (file)
@@ -13773,8 +13773,19 @@ merge_string_cste (op1, op2, after)
        string = null_pointer;
       else if (TREE_TYPE (op2) == char_type_node)
        {
-         ch[0] = (char )TREE_INT_CST_LOW (op2);
-         ch[1] = '\0';
+         /* Convert the character into UTF-8.  */
+         unsigned char c = (unsigned char) TREE_INT_CST_LOW (op2);
+         unsigned char *p = (unsigned char *) ch;
+         if (0x01 <= c
+             && c <= 0x7f)
+           *p++ = c;
+         else
+           {
+             *p++ = c >> 6 | 0xc0;
+             *p++ = c & 0x3f | 0x80;
+           }
+         *p = '\0';
          string = ch;
        }
       else