This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Off-by-one error in money_get::do_put(..., long double)?
- From: Paolo Carlini <pcarlini at suse dot de>
- To: Richard Sandiford <rsandifo at redhat dot com>
- Cc: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Tue, 20 Jan 2004 00:07:27 +0100
- Subject: Re: Off-by-one error in money_get::do_put(..., long double)?
- References: <87smibk8tw.fsf@redhat.com>
Richard Sandiford wrote:
22_locale/money_put/put/char/4.cc was failing on mipsel-linux-gnu
because money_get::do_put wasn't copying across the null terminator
from __cs to __ws. It looks from the other functions in the file
like the call to __ctype.widen() is at fault.
OTOH, nothing about C++ is obvious to me, so I thought I'd better
check whether this was the right fix. It's enough to make this
particular test case pass, but it'll be a couple of days before
the next bootstrap & regression test completes. OK if it does?
Well, good catch!
However, for performance reasons, I'd rather prefer this different
fix, affecting the string constructor:
- string_type __digits(__ws);
+ string_type __digits(__ws, __len);
Can you regtest it on you platform?
Why? If you pass to the string constructor __ws, that's a null-terminated
C-string and the constructor has to compute its length. But we already
know how many characters (not including the final '\0', eh!) are really
produced by __convert_from_v: we can pass this value too!
If you can regtest this change on i686-pc-linux-gnu too is OK for
mainline and 3_4.
Paolo.