------- Comment #4 from pcarlini at suse dot de  2007-04-01 23:23 -------
Hi Dave. I tell you the first things I see on x86: do_get_date calls
_M_extract_via_format. In the latter there is a loop over __i, from 0 to __len
== 11: the char array __format is parsed. The first two times 'if
(__ctype.narrow(__format[__i], 0) == '%')' is executed (that is, for i == 0, i
== 1, where __format[0] == 0x897f (35199 base 10) and __format[1] == 0x5143),
narrow returns -1 and we move ahead, that's expected, we are looking for a '%'.
The third time a '%' is found, and then __c == 'Y'.

I would suggest checking the contents of __format when _M_extract_via_format
starts, that is verifying that it begins with the exact same two chars of wstr
in the C++ source and therefore L'%' and L'Y'.

Anyway, by the time we switch to 'Y', we moved ahead 2 positions in __format
(__i == 2) and bumped two times __beg. Therefore _M_extract_num will start
reading the third char of wstr, and then the other 3 forming a year L'2' L'0'
L'0' L'3'...

Note that in general, wctob can well return -1, every time there is no plain
char equivalent of a multi byte char. In the testcase happens for the first two
chars of __format, then finally we find L'%' and L'Y' which have of course '%'
and 'Y' as equivalent.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31413

Reply via email to