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

--- Comment #15 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
commit r10-7122-g60342fdbfb0630243d2b85d2ca45204ded990b17
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Wed Mar 11 09:34:59 2020 +0100

    value-prof: Fix abs uses in value-prof.c [PR93962]

    Jeff has recently fixed dump_histogram_value to use std::abs instead of
abs,
    because on FreeBSD apparently the ::abs isn't overloaded and only has
    int abs (int);
    Seems on Solaris /usr/include/iso/stdlib_iso.h abs has:
    int abs (int);
    long abs (long);
    overloads but already not
    long long abs (long long);
    and there is another abs use in get_nth_most_common_value, also on int64_t.
    The long long std::abs (long long); overload is there only in C++11 and we
    in GCC10 still support C++98.

    Martin has said that a counter should never be INT64_MIN, so IMHO it is
    better to use abs_hwi which will assert that.

    2020-03-11  Jakub Jelinek  <ja...@redhat.com>

            PR bootstrap/93962
            * value-prof.c (dump_histogram_value): Use abs_hwi instead of
            std::abs.
            (get_nth_most_common_value): Use abs_hwi instead of abs.

Reply via email to