[PATCH][libstdc++][testsuite] XFAIL tests relying on long double-to-string conversions on broken newlib

Kyrill Tkachov kyrylo.tkachov@foss.arm.com
Mon Dec 12 13:55:00 GMT 2016


Hi all,

I've been investigating the execution failures of:
21_strings/basic_string/numeric_conversions/char/stod.cc
21_strings/basic_string/numeric_conversions/wchar_t/stod.cc
21_strings/basic_string/numeric_conversions/wchar_t/stold.cc
27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc

on aarch64-none-elf, a newlib target.
The reason they are failing is because they are converting a long double to a string using to_string
before trying to convert it back into a number.
to_string ends up calling a vsnprintf from the C library (newlib in this case) with the %Lf format
to convert from long double.
Unfortunately the %Lf format is broken in newlib for platforms where long double is not the same as double.
It gives bogus results because newlib doesn't implement the long double variant of frexp (frexpl) which is needed
to implement printf properly. So it ends up using frexp even on long doubles. This gives wrong results which causes
these tests to fail.

So this patch marks them as XFAIL and adds an effective target check for broken newlib versions.

With this patch these tests appear as XFAIL on aarch64-none-elf.

Ok for trunk?

Thanks,
Kyrill

2016-12-12  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * lib/target-supports.exp
     (check_effective_target_newlib_broken_long_double_io): New check.
     (check_effective_target_frexpl): Likewise.

2016-12-12  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * testsuite/21_strings/basic_string/numeric_conversions/char/stod.cc:
     XFAIL run if newlib_broken_long_double_io.
     * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stod.cc:
     Likewise.
     * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stold.cc:
     Likewise.
     * testsuite/27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc:
     Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libstd.patch
Type: text/x-patch
Size: 4977 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20161212/d8baf0ac/attachment.bin>


More information about the Libstdc++ mailing list