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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org

--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I think even the using of std::abs in the #c8 case isn't correct, because the
std::abs (long long); overload has been only added in C++11 and we in GCC 10
still do support C++98 compilers.
So I think we instead should use abs_hwi (or absu_hwi, depending on if the most
negative value can appear or not) instead of std::abs or abs in value-prof.c.
So e.g.
--- gcc/value-prof.c    2020-03-05 07:58:02.693135980 +0100
+++ gcc/value-prof.c    2020-03-10 14:32:10.723649888 +0100
@@ -266,7 +266,7 @@ dump_histogram_value (FILE *dump_file, h
          if (hist->hvalue.counters)
            {
              fprintf (dump_file, " all: %" PRId64 "%s, values: ",
-                      std::abs ((int64_t) hist->hvalue.counters[0]),
+                      absu_hwi (hist->hvalue.counters[0]),
                       hist->hvalue.counters[0] < 0
                       ? " (values missing)": "");
              for (unsigned i = 0; i < GCOV_TOPN_VALUES; i++)
@@ -743,7 +743,7 @@ get_nth_most_common_value (gimple *stmt,
   *count = 0;
   *value = 0;

-  gcov_type read_all = abs (hist->hvalue.counters[0]);
+  gcov_type read_all = absu_hwi (hist->hvalue.counters[0]);

   gcov_type v = hist->hvalue.counters[2 * n + 1];
   gcov_type c = hist->hvalue.counters[2 * n + 2];

or with s/absu/abs/.

Reply via email to