From: Jan Hubicka Date: Thu, 11 Jan 2018 17:46:01 +0000 (+0100) Subject: re PR middle-end/83718 (ICE: Floating point exception in profile_count::apply_scale) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0526ed2aef5ba7faa8ea26015e9854db82a71395;p=gcc.git re PR middle-end/83718 (ICE: Floating point exception in profile_count::apply_scale) PR middle-end/83718 * tree-inline.c (copy_cfg_body): Adjust num&den for scaling after they are computed. * g++.dg/torture/pr83718.C: New testcase. From-SVN: r256544 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 878d72c2239..f8bd20f6aeb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-01-11 Jan Hubicka + + PR middle-end/83718 + * tree-inline.c (copy_cfg_body): Adjust num&den for scaling + after they are computed. + 2018-01-11 Bin Cheng PR tree-optimization/83695 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4524063d0f3..f1eb59b80b1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-01-11 Jan Hubicka + + PR middle-end/83718 + * g++.dg/torture/pr83718.C: New testcase. + 2018-01-11 Martin Jambor PR ipa/83178 diff --git a/gcc/testsuite/g++.dg/torture/pr83718.C b/gcc/testsuite/g++.dg/torture/pr83718.C new file mode 100644 index 00000000000..2fa28064202 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr83718.C @@ -0,0 +1,115 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -std=c++11" } */ + +class a +{ +public: + int c (const char *); +}; +class B +{ + virtual int *d (a, bool); +}; + +bool e, f, g; + +class: B +{ + int ah; + int * + d (a, bool) + { + if (e) + return &ah; + a bj; + bj.c (""); + if (f) + return &ah; + bj.c (""); + if (f) + return &ah; + bj.c (""); + if (f) + return &ah; + bj.c (""); + if (f) + return &ah; + bj.c (""); + if (f) + return &ah; + bj.c (""); + if (f) + return &ah; + bj.c (""); + if (f) + return &ah; + bj.c (""); + if (f) + return &ah; + bj.c (""); + if (f) + return &ah; + bj.c (""); + if (f) + return &ah; + bj.c (""); + if (f) + return &ah; + bj.c (""); + if (f) + return &ah; + bj.c (""); + if (f) + return &ah; + bj.c (""); + if (f) + return &ah; + bj.c (""); + if (f) + return &ah; + bj.c (""); + if (f) + return &ah; + bj.c (""); + if (f) + return &ah; + bj.c (""); + if (f) + return &ah; + bj.c (""); + if (f) + return &ah; + bj.c (""); + if (f) + return &ah; + bj.c (""); + if (f) + return &ah; + bj.c (""); + if (f) + return &ah; + bj.c (""); + if (f) + return &ah; + bj.c (""); + if (f) + return &ah; + bj.c (""); + if (f) + return &ah; + bj.c (""); + if (f) + return &ah; + bj.c (""); + if (f) + return &ah; + bj.c (""); + if (g) + return &ah; + if (f) + return &ah; + e = a ().c(""); + return &ah; + } +} b; + diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 5910745d096..b0d9beb530a 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -2683,8 +2683,6 @@ copy_cfg_body (copy_body_data * id, profile_count den = ENTRY_BLOCK_PTR_FOR_FN (src_cfun)->count; profile_count num = entry_block_map->count; - profile_count::adjust_for_ipa_scaling (&num, &den); - cfun_to_copy = id->src_cfun = DECL_STRUCT_FUNCTION (callee_fndecl); /* Register specific tree functions. */ @@ -2707,6 +2705,8 @@ copy_cfg_body (copy_body_data * id, ENTRY_BLOCK_PTR_FOR_FN (cfun)->count = den; } + profile_count::adjust_for_ipa_scaling (&num, &den); + /* Must have a CFG here at this point. */ gcc_assert (ENTRY_BLOCK_PTR_FOR_FN (DECL_STRUCT_FUNCTION (callee_fndecl)));