From: Jan Hubicka Date: Fri, 8 Dec 2017 11:27:28 +0000 (+0100) Subject: re PR tree-optimization/83609 (ICE in read_complex_part at gcc/expr.c:3202) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f6422f23bba3ef7a6ed0fcf9525ad7c92d1905aa;p=gcc.git re PR tree-optimization/83609 (ICE in read_complex_part at gcc/expr.c:3202) * profile-count.c (profile_count::from_gcov_type): Move from profile-count.h; handle overflow. * profile-count. (profile_count::from_gcov_type): Move offline. PR middle-end/83609 * gcc.c-torture/compile/pr83069.c: New testcase. From-SVN: r255507 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dcd1fb68533..f7fac96d27c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-12-08 Jan Hubicka + + PR middle-end/83609 + * profile-count.c (profile_count::from_gcov_type): Move from + profile-count.h; handle overflow. + * profile-count.h (profile_count::from_gcov_type): Move offline. + 2017-12-08 Segher Boessenkool PR rtl-optimization/83304 diff --git a/gcc/profile-count.c b/gcc/profile-count.c index 5d8e9c55913..3b106d3f3ca 100644 --- a/gcc/profile-count.c +++ b/gcc/profile-count.c @@ -327,3 +327,21 @@ profile_count::combine_with_ipa_count (profile_count ipa) return this->global0 (); return this->global0adjusted (); } + +/* The profiling runtime uses gcov_type, which is usually 64bit integer. + Conversions back and forth are used to read the coverage and get it + into internal representation. */ +profile_count +profile_count::from_gcov_type (gcov_type v) + { + profile_count ret; + gcc_checking_assert (v >= 0); + if (dump_file && v >= (gcov_type)max_count) + fprintf (dump_file, + "Capping gcov count %" PRId64 " to max_count %" PRId64 "\n", + (int64_t) v, (int64_t) max_count); + ret.m_val = MIN (v, (gcov_type)max_count); + ret.m_quality = profile_precise; + return ret; + } + diff --git a/gcc/profile-count.h b/gcc/profile-count.h index 2ffa33f639c..75456ad3586 100644 --- a/gcc/profile-count.h +++ b/gcc/profile-count.h @@ -667,18 +667,6 @@ public: return c; } - /* The profiling runtime uses gcov_type, which is usually 64bit integer. - Conversions back and forth are used to read the coverage and get it - into internal representation. */ - static profile_count from_gcov_type (gcov_type v) - { - profile_count ret; - gcc_checking_assert (v >= 0 && (uint64_t) v <= max_count); - ret.m_val = v; - ret.m_quality = profile_precise; - return ret; - } - /* Conversion to gcov_type is lossy. */ gcov_type to_gcov_type () const { @@ -1083,6 +1071,11 @@ public: global0. */ profile_count combine_with_ipa_count (profile_count ipa); + /* The profiling runtime uses gcov_type, which is usually 64bit integer. + Conversions back and forth are used to read the coverage and get it + into internal representation. */ + static profile_count from_gcov_type (gcov_type v); + /* LTO streaming support. */ static profile_count stream_in (struct lto_input_block *); void stream_out (struct output_block *); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3b1a7e29111..cae9220a63d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-12-08 Jan Hubicka + + PR middle-end/83609 + * gcc.c-torture/compile/pr83069.c: New testcase. + 2017-12-08 Richard Biener PR tree-optimization/81303 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr83069.c b/gcc/testsuite/gcc.c-torture/compile/pr83069.c new file mode 100644 index 00000000000..addb2df765b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr83069.c @@ -0,0 +1,14 @@ +#define MAX 98 + +void foo (unsigned long *res, unsigned long in) +{ + for (unsigned long a = 0; a < MAX; a++) + for (unsigned long b = 0; b < MAX; b++) + for (unsigned long c = 0; c < MAX; c++) + for (unsigned long d = 0; d < MAX; d++) + for (unsigned long e = 0; e < MAX; e++) + for (unsigned long f = 0; f < MAX; f++) + for (unsigned long g = 0; g < MAX; g++) + *res += a * in; +} +