From 39c429372b27f6bedfb2459c7695531c1a37c0ea Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Mon, 12 Dec 2016 15:47:47 +0000 Subject: [PATCH] [libstdc++][testsuite] XFAIL tests relying on long double-to-string conversions on broken newlib * lib/target-supports.exp (check_effective_target_newlib_broken_long_double_io): New check. (check_effective_target_frexpl): Likewise. * 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. From-SVN: r243558 --- gcc/testsuite/ChangeLog | 6 +++++ gcc/testsuite/lib/target-supports.exp | 26 +++++++++++++++++++ libstdc++-v3/ChangeLog | 11 ++++++++ .../numeric_conversions/char/stod.cc | 1 + .../numeric_conversions/char/stold.cc | 1 + .../numeric_conversions/wchar_t/stod.cc | 2 ++ .../numeric_conversions/wchar_t/stold.cc | 2 ++ .../inserters_arithmetic/char/hexfloat.cc | 1 + 8 files changed, 50 insertions(+) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 588c51bd140..35db8198c28 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2016-12-12 Kyrylo Tkachov + + * lib/target-supports.exp + (check_effective_target_newlib_broken_long_double_io): New check. + (check_effective_target_frexpl): Likewise. + 2016-12-12 Marek Polacek PR middle-end/78716 diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 0fc0bafa67d..c3110dc3d72 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -6765,6 +6765,17 @@ proc check_effective_target_newlib {} { }] } +# Some newlib versions don't provide a frexpl and instead depend +# on frexp to implement long double conversions in their printf-like +# functions. This leads to broken results. Detect such versions here. + +proc check_effective_target_newlib_broken_long_double_io {} { + if { [is-effective-target newlib] && ![is-effective-target frexpl] } { + return 1 + } + return 0 +} + # Return true if this is NOT a Bionic target. proc check_effective_target_non_bionic {} { @@ -7380,6 +7391,21 @@ proc check_effective_target_pow10 { } { } "-lm" ] } +# Return 1 if frexpl function exists. + +proc check_effective_target_frexpl { } { + return [check_runtime frexpl { + #include + int main () { + long double x; + int y; + x = frexpl (5.0, &y); + return 0; + } + } "-lm" ] +} + + # Return 1 if issignaling function exists. proc check_effective_target_issignaling {} { return [check_runtime issignaling { diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 1a6f871c4ba..b2cd76c96bb 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,14 @@ +2016-12-12 Kyrylo Tkachov + + * 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. + 2016-12-12 Jonathan Wakely * testsuite/experimental/filesystem/operations/is_empty.cc: diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stod.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stod.cc index 7e7c1347eab..08864113007 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stod.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stod.cc @@ -1,5 +1,6 @@ // { dg-do run { target c++11 } } // { dg-require-string-conversions "" } +// { dg-xfail-run-if "broken long double IO" { newlib_broken_long_double_io } "*" "" } // 2008-06-15 Paolo Carlini diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stold.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stold.cc index 15a4dcaddb4..df39a50b9c8 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stold.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/stold.cc @@ -1,5 +1,6 @@ // { dg-do run { target c++11 } } // { dg-require-string-conversions "" } +// { dg-xfail-run-if "broken long double IO" { newlib_broken_long_double_io } "*" "" } // 2008-06-15 Paolo Carlini diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stod.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stod.cc index 81735dd1866..259dc650248 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stod.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stod.cc @@ -1,5 +1,7 @@ // { dg-do run { target c++11 } } // { dg-require-string-conversions "" } +// { dg-xfail-run-if "broken long double IO" { newlib_broken_long_double_io } "*" "" } + // 2008-06-15 Paolo Carlini // Copyright (C) 2008-2016 Free Software Foundation, Inc. diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stold.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stold.cc index 82b8c8bb846..3a95010945b 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stold.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stold.cc @@ -1,5 +1,7 @@ // { dg-do run { target c++11 } } // { dg-require-string-conversions "" } +// { dg-xfail-run-if "broken long double IO" { newlib_broken_long_double_io } "*" "" } + // 2008-06-15 Paolo Carlini // Copyright (C) 2008-2016 Free Software Foundation, Inc. diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc index 364bc56d2fa..839037917c9 100644 --- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc @@ -1,6 +1,7 @@ // { dg-do run { target c++11 } } // { dg-require-string-conversions "" } // { dg-xfail-run-if "PR libstdc++/64054" { *-*-solaris* } } +// { dg-xfail-run-if "broken long double IO" { newlib_broken_long_double_io } "*" "" } // 2014-03-27 Rüdiger Sonderfeld // test the hexadecimal floating point inserters (facet num_put) -- 2.30.2