OSDN Git Service

Fix string concatenation bug.
authorgreen <green@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 8 Oct 2002 07:10:49 +0000 (07:10 +0000)
committergreen <green@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 8 Oct 2002 07:10:49 +0000 (07:10 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@57912 138bc75d-0d04-0410-961f-82ee72b054a4

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

index e3f1c69..1ef902c 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 217f74c..bb7155b 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