This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

20010325-1 vs wide strings



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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]