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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Sparc & Alpha on codecvt_unicode? (was: Re: failure notice)


Ulrich Weigand wrote:

> (Sorry if you get this twice, it looks like the first attempt to send it
> failed ...)

My fault. I misspelled libstdc++ in my message :(

> Thinking about it, isn't the library completely correct?  The bytes
> actually returned in i_arr read
>
>   0x00 0x62 0x00 0x6c 0x00 0x61 ...
>
> which does appear to be the correct UCS-2BE representation of the
> string in question.
>
> However, the value it is compared against is
>
>   0x62 0x00 0x6c 0x00 0x61 0x00 ...
>
> which is *not* a proper UCS-2BE representation.
>
> This value is generated in the test case source like this:
>
>   int_type        i_lit_base[25] =
>   {
>     0x6200, 0x6c00, 0x6100, 0x6300, 0x6b00, 0x2000, 0x7000, 0x6500, 0x6100,
>     0x7200, 0x6c00, 0x2000, 0x6a00, 0x6100, 0x7300, 0x6d00, 0x6900, 0x6e00,
>     0x6500, 0x2000, 0x7400, 0x6500, 0x6100, 0xa000
>   };
>
> But it obviously depends on the endianness of the host platform
> how these short ints are represented as byte sequence.  The test
> case does not appear to take this into account properly.  It looks
> like the test case can only be correct on little-endian hosts.

Thanks. I think your analysis is very interesting. Indeed, I would be tempted to
change the test to something like:

 char        i_lit_base[50] =
 {
    0x00, 0x62, 0x00, 0x6c, ...
};

likewise, for test02, and I'm almost sure (not really tested) it would pass on
i686, ia64, s390 and powerpc!

> However, I do not quite understand why the test appears to succeed
> on other big-endian platforms like alpha and sparc ...

Yes. This is really troubling. Why?!?
(by the way, I cannot find myself relevant Sparc-linux testresults, only Alpha)

There is a possibility that we cannot exclude, however: what if
_GLIBCPP_USE___ENC_TRAITS were in fact undefined on those platforms and the test
not really run?

At this point we really need some feedback from Sparc and Alpha people.

Anyone out there willing to provide some information??

Ciao, Paolo.



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