This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
20010325-1 vs wide strings
- To: gcc at gcc dot gnu dot org
- Subject: 20010325-1 vs wide strings
- From: DJ Delorie <dj at redhat dot com>
- Date: Wed, 9 May 2001 22:38:35 -0400
gcc.c-torture/execute/20010325-1.c says:
This tests for inconsistency in whether wide STRING_CSTs use the host
or the target endianness. */
if (L"a" "b"[1] != L'b')
Yet c-common.c (combine_strings) naively does this:
for (i = 0; i < len; i++)
{
if (WCHAR_TYPE_SIZE == HOST_BITS_PER_SHORT)
((short *) q)[i] = TREE_STRING_POINTER (t)[i];
else
((int *) q)[i] = TREE_STRING_POINTER (t)[i];
}
Sure enough, 20010325-1 fails for a big endian target on a little
endian machine. Is the above code obviously wrong, or is there
something subtle going on here?