https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107815

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to r...@cebitec.uni-bielefeld.de from comment #2)
> > --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> > Can you please uncomment the
> > //    std::cout << i << ' ' << std::string_view (str1, ptr1) << '\n';
> > and
> > //    std::cout << i << ' ' << std::string_view (str1, ptr5) << '\n';
> > lines in the test, so that it is clear at least which test it is on?
> 
> Sure.  This is supposed to print u, I assume ;-)

Oops, sure.
> 
> The line before the assertion failure is
> 
> 1.18973e+4932 1e+4932
> /vol/gcc/src/hg/master/local/libstdc++-v3/testsuite/20_util/to_chars/
> float128_c++23.cc:66: void test(std::chars_format): Assertion 'ec2 ==
> std::errc() && ptr2 - str2 == ptr1 - str1' failed.
> 
> i.e. LDBL_MAX.

This is weird.  If line 66 is reached, fmt must be std::chars_format::fixed
and in that case ptr1 - str1 should be 4933 and str1 should be that many chars
long string starting with
11897314953572317650857593266280070161964690526416940455296988842121635797553123923249740128484620735259020335647491268597552654335738044626726987519452614908534619587250212628458657994054044935746815
If you get just 1e+4932 when asked for fixed format, something is just wrong,
that is scientific or general format.
> 
> > If line 66 fails, it is a fixed printing test trying to verify
> > that the string created by line 60 was actually the minimal.
> 
> It doesn't now reliably: I compiled with -g3 -O0 to be able to check
> things with gdb if needed.
> 
> > On SPARC Solaris, I assume long double is IEEE quad, and it is the shortest
> > version, so should use ryu library for both cases.
> 
> It is, although only ever implemented in software.
> 
> > Line 74 failure is about whether the created string can be read back,
> > in that case for IEEE quad fast_float library can't be used and so it should
> > use newlocale/uselocale/strtold/uselocale/freelocale, or if the OS doesn't
> > support newlocale/uselocale/freelocale most likely just strtod with lost
> > precision (so in that case the test would fail) on line 74.
> 
> I'm not seeing the failure on l.74 any longer, even with the default
> optimization options.  There has been an effort to introduce an xpg7
> locale, but that had quite a number of unresolved issues (both on AIX
> and Solaris) and was never finished.  Currently, we're stuck with
> generic.

Reply via email to