20010325-1 vs wide strings
DJ Delorie
dj@redhat.com
Wed May 9 19:38:00 GMT 2001
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?
More information about the Gcc
mailing list