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]

Re: ctype<wchar>::do_is(const wchar_t *, const wchar_t *, mask *)problem


Hi,

Ulrich Weigand wrote:

Hello,

I am getting testsuite failures on
22_locale/ctype/is/wchar_t/wrapped_env.cc.

This test case does:

 cc0 = strlit01;
 cc1 = gctype.is(cc0, cc0 + 13, m02);
 VERIFY( cc1 == strlit01 + 13);

which as far as I understand the C++ standard is supposed to fill the m02
array with codes classifying the characters from strlit01.

Indeed.

However, the implementation that is being called (located in the source
file config/locale/gnu/ctype_members.cc) does this:

 const wchar_t*
 ctype<wchar_t>::
 do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __m) const
 {
   while (__lo < __hi && !this->do_is(*__m, *__lo))
     ++__lo;
   return __lo;
 }

which doesn't appear to be correct (__m is used as input parameter,
not output; only the first element of __m is ever used) ...

In fact, isn't correct, or better said, perhaps, ctype<wchar_t>::do_is
is still unimplemented: that code it's just a place holder roughly
inspired by do_scan_is below ;)

I'm saying this with confidence basing on the many #if 0 in testsuite/22_locale/ctype/is/wchar_t/1.cc which effectively disable
most of it...


It's weird, however, that only on s390 that minimal kind-of-test fails:
evidently the returned __lo < __hi.

Since the standard prescribes for do_is to always return __hi, we
can probably "fix" the failure changing for the time being the place
holder like this:

--- ctype_members.cc.~1.9.~     2003-03-15 05:53:51.000000000 +0100
+++ ctype_members.cc    2003-03-26 22:00:40.000000000 +0100
@@ -141,7 +141,7 @@
  {
    while (__lo < __hi && !this->do_is(*__m, *__lo))
      ++__lo;
-    return __lo;
+    return __hi;
  }

const wchar_t*

Thanks,
Paolo.


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