This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: Off-by-one error in money_get::do_put(..., long double)?


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.






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