[committed] libstdc++: Implement "Safe Integral Comparisons" (P0586R2)

Christophe Lyon christophe.lyon@linaro.org
Tue Feb 18 13:05:00 GMT 2020


Hi,

On Mon, 17 Feb 2020 at 14:22, Jonathan Wakely <jwakely@redhat.com> wrote:
>
>         * include/std/type_traits (__is_standard_integer): New helper trait.
>         * include/std/utility (cmp_equal, cmp_not_equal, cmp_less, cmp_greater)
>         (cmp_less_equal, cmp_greater_equal, in_range): Define for C++20.
>         * include/std/version (__cpp_lib_integer_comparison_functions): Define.
>         * testsuite/20_util/integer_comparisons/1.cc: New test.
>         * testsuite/20_util/integer_comparisons/2.cc: New test.
>         * testsuite/20_util/integer_comparisons/equal.cc: New test.
>         * testsuite/20_util/integer_comparisons/equal_neg.cc: New test.
>         * testsuite/20_util/integer_comparisons/greater_equal.cc: New test.
>         * testsuite/20_util/integer_comparisons/greater_equal_neg.cc: New test.
>         * testsuite/20_util/integer_comparisons/greater_neg.cc: New test.
>         * testsuite/20_util/integer_comparisons/in_range.cc: New test.
>         * testsuite/20_util/integer_comparisons/in_range_neg.cc: New test.
>         * testsuite/20_util/integer_comparisons/less.cc: New test.
>         * testsuite/20_util/integer_comparisons/less_equal.cc: New test.
>         * testsuite/20_util/integer_comparisons/less_equal_neg.cc: New test.
>         * testsuite/20_util/integer_comparisons/less_neg.cc: New test.
>         * testsuite/20_util/integer_comparisons/not_equal.cc: New test.
>         * testsuite/20_util/integer_comparisons/not_equal_neg.cc: New test.
>
> Tested powerpc64le-linux, committed to master.
>

Some of these new tests fail on arm (and s390 according to gcc-testresults):
FAIL: 20_util/integer_comparisons/equal.cc execution test
FAIL: 20_util/integer_comparisons/greater_equal.cc execution test
FAIL: 20_util/integer_comparisons/less.cc execution test
FAIL: 20_util/integer_comparisons/less_equal.cc execution test
FAIL: 20_util/integer_comparisons/not_equal.cc execution test

The log says:
/libstdc++-v3/testsuite/20_util/integer_comparisons/equal.cc:64: void
test03(): Assertion '!std::cmp_equal(u, ul)' failed.
/libstdc++-v3/testsuite/20_util/integer_comparisons/greater_equal.cc:70:
void test03(): Assertion '!std::cmp_greater_equal(u, ul)' failed.
/libstdc++-v3/testsuite/20_util/integer_comparisons/less.cc:68: void
test03(): Assertion 'std::cmp_less(u, ul)' failed.
/libstdc++-v3/testsuite/20_util/integer_comparisons/less_equal.cc:71:
void test03(): Assertion '!std::cmp_less_equal(ul, u)' failed.
/libstdc++-v3/testsuite/20_util/integer_comparisons/not_equal.cc:65:
void test03(): Assertion 'std::cmp_not_equal(u, ul)' failed.

Christophe



More information about the Libstdc++ mailing list