[Bug bootstrap/93962] bootstrap fails with gcc/value-prof.c:268:28 : error: format '%lld' expects argument of type 'long long int', but argument 3 hastype 'int'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93962 Jakub Jelinek changed: What|Removed |Added Resolution|--- |FIXED Status|NEW |RESOLVED --- Comment #16 from Jakub Jelinek --- .
[Bug bootstrap/93962] bootstrap fails with gcc/value-prof.c:268:28 : error: format '%lld' expects argument of type 'long long int', but argument 3 hastype 'int'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93962 --- Comment #15 from Jakub Jelinek --- commit r10-7122-g60342fdbfb0630243d2b85d2ca45204ded990b17 Author: Jakub Jelinek 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 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.
[Bug bootstrap/93962] bootstrap fails with gcc/value-prof.c:268:28 : error: format '%lld' expects argument of type 'long long int', but argument 3 hastype 'int'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93962 --- Comment #14 from Jakub Jelinek --- Ok, I'll test a patch with abs_hwi in both spots then. There will be an assertion in there that it is not INT64_MIN.
[Bug bootstrap/93962] bootstrap fails with gcc/value-prof.c:268:28 : error: format '%lld' expects argument of type 'long long int', but argument 3 hastype 'int'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93962 --- Comment #13 from Martin Liška --- > 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. No, the counter can never be INT64_MIN.
[Bug bootstrap/93962] bootstrap fails with gcc/value-prof.c:268:28 : error: format '%lld' expects argument of type 'long long int', but argument 3 hastype 'int'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93962 --- Comment #12 from Gerald Pfeifer --- Created attachment 48011 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48011=edit Preprocessed value-prof.c for the failure case on FreeBSD 11/i386 (I've been struggling to create the preprocessed source files, but keep working on it. This is the first one - for the failure case.)
[Bug bootstrap/93962] bootstrap fails with gcc/value-prof.c:268:28 : error: format '%lld' expects argument of type 'long long int', but argument 3 hastype 'int'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93962 Jakub Jelinek changed: What|Removed |Added CC||marxin at gcc dot gnu.org --- Comment #11 from Jakub Jelinek --- 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.c2020-03-05 07:58:02.693135980 +0100 +++ gcc/value-prof.c2020-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/.
[Bug bootstrap/93962] bootstrap fails with gcc/value-prof.c:268:28 : error: format '%lld' expects argument of type 'long long int', but argument 3 hastype 'int'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93962 Eric Botcazou changed: What|Removed |Added CC||ebotcazou at gcc dot gnu.org --- Comment #10 from Eric Botcazou --- There is another abs at line 746 which causes a bootstrap failure on Solaris 11: /homes/botcazou/gcc-head/src/gcc/value-prof.c: In function 'bool get_nth_most_common_value(gimple*, const char*, histogram_value, gcov_type*, gcov_type*, gcov_type*, unsigned int)': /homes/botcazou/gcc-head/src/gcc/value-prof.c:746:53: error: call of overloaded 'abs(gcov_type&)' is ambiguous gcov_type read_all = abs (hist->hvalue.counters[0]); ^ /homes/botcazou/gcc-head/src/gcc/value-prof.c:746:53: note: candidates are: In file included from /usr/include/stdlib.h:11:0, from /homes/botcazou/gcc-head/src/gcc/system.h:258, from /homes/botcazou/gcc-head/src/gcc/value-prof.c:21: /usr/include/iso/stdlib_iso.h:154:23: note: long int std::abs(long int) inline long abs(long _l) { return labs(_l); } ^ /usr/include/iso/stdlib_iso.h:108:12: note: int std::abs(int) extern int abs(int); ^ gmake[3]: *** [value-prof.o] Error 1
[Bug bootstrap/93962] bootstrap fails with gcc/value-prof.c:268:28 : error: format '%lld' expects argument of type 'long long int', but argument 3 hastype 'int'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93962 Jeffrey A. Law changed: What|Removed |Added Summary|[10 regression] bootstrap |bootstrap fails with |fails with |gcc/value-prof.c:268:28 : |gcc/value-prof.c:268:28 : |error: format '%lld' |error: format '%lld'|expects argument of type |expects argument of type|'long long int', but |'long long int', but|argument 3 hastype 'int' |argument 3 hastype 'int'| --- Comment #9 from Jeffrey A. Law --- Fixed on the trunk, but kept open so that Gerald can attach the .ii file for further analysis if Jakub is interested.