c-common.c (combine_strings): Widen strings in a host-endian-independent way.
authorDJ Delorie <dj@redhat.com>
Thu, 10 May 2001 17:39:19 +0000 (13:39 -0400)
committerDJ Delorie <dj@gcc.gnu.org>
Thu, 10 May 2001 17:39:19 +0000 (13:39 -0400)
* c-common.c (combine_strings): Widen strings in a
host-endian-independent way.

From-SVN: r41941

gcc/ChangeLog
gcc/c-common.c

index db35f560fd02f5ec8e83572c530ea82a0161d086..11bf8a5ad82e5ab251cdda2e7f17f8b9ba1fe613 100644 (file)
@@ -1,3 +1,8 @@
+2001-05-10  DJ Delorie  <dj@redhat.com>
+
+       * c-common.c (combine_strings): Widen strings in a
+       host-endian-independent way.
+
 2001-05-10  Joseph S. Myers  <jsm28@cam.ac.uk>
 
        * c-parse.in: Remove many shift/reduce conflicts.  Update
index 751d67d2e0d0995cea2c2bc869574479e0ac93df..a1dc31c3160e31d367bc5df502101132dc914011 100644 (file)
@@ -583,15 +583,22 @@ combine_strings (strings)
            }
          else
            {
-             int i;
+             int i, j;
              for (i = 0; i < len; i++)
                {
-                 if (WCHAR_TYPE_SIZE == HOST_BITS_PER_SHORT)
-                   ((short *) q)[i] = TREE_STRING_POINTER (t)[i];
+                 if (BYTES_BIG_ENDIAN)
+                   {
+                     for (j=0; j<(WCHAR_TYPE_SIZE / BITS_PER_UNIT)-1; j++)
+                       *q++ = 0;
+                     *q++ = TREE_STRING_POINTER (t)[i];
+                   }
                  else
-                   ((int *) q)[i] = TREE_STRING_POINTER (t)[i];
+                   {
+                     *q++ = TREE_STRING_POINTER (t)[i];
+                     for (j=0; j<(WCHAR_TYPE_SIZE / BITS_PER_UNIT)-1; j++)
+                       *q++ = 0;
+                   }
                }
-             q += len * wchar_bytes;
            }
        }
       if (wide_flag)