Bug 83718 - [8 Regression] ICE: Floating point exception in profile_count::apply_scale
Summary: [8 Regression] ICE: Floating point exception in profile_count::apply_scale
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 8.0
: P3 normal
Target Milestone: 8.0
Assignee: Jan Hubicka
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2018-01-07 02:22 UTC by Matthias Klose
Modified: 2018-01-11 18:05 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 7.2.1
Known to fail: 8.0
Last reconfirmed: 2018-01-08 00:00:00


Attachments
test-case (207 bytes, text/x-csrc)
2018-01-10 12:47 UTC, Martin Liška
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2018-01-07 02:22:04 UTC
seen with r256272, building slic3r on amd64:

$ g++ -c -O2 Print.ii 
during GIMPLE pass: fnsplit
Print.ii: In function 'virtual int*<unnamed class>::d(a, bool)':
Print.ii:138:4: internal compiler error: Floating point exception
 } b;
    ^
0xbe45bf crash_signal
        ../../src/gcc/toplev.c:325
0xc2f89f profile_count::apply_scale(profile_count, profile_count) const
        ../../src/gcc/profile-count.h:76
0xc2f89f copy_edges_for_bb
        ../../src/gcc/tree-inline.c:2231
0xc2f89f copy_cfg_body
        ../../src/gcc/tree-inline.c:2752
0xc2f89f copy_body
        ../../src/gcc/tree-inline.c:2971
0xc32fc1 tree_function_versioning(tree_node*, tree_node*, vec<ipa_replace_map*, va_gc, vl_embed>*, bool, bitmap_head*, bool, bitmap_head*, basic_block_def*)
        ../../src/gcc/tree-inline.c:6039
0x8cf109 cgraph_node::create_version_clone_with_body(vec<cgraph_edge*, va_heap, vl_ptr>, vec<ipa_replace_map*, va_gc, vl_embed>*, bitmap_head*, bool, bitmap_head*, basic_block_def*, char const*)
        ../../src/gcc/cgraphclones.c:984
0x1251619 split_function
        ../../src/gcc/ipa-split.c:1369
0x1251619 execute_split_functions
        ../../src/gcc/ipa-split.c:1896
Please submit a full bug report,
with preprocessed source if appropriate.


$ cat Print.ii
class a {
public:
  int c(const char *);
};
class B {
  virtual int *d(a, bool);
};
bool e, f, g, h, i, j, k, l, m, n, o, p, aa, q, r, s, t, u, v, ab, w, x, y, z,
    ac, ad;
class : B {
  int ae;
  int af;
  int ag;
  int ah;
  int ai;
  int aj;
  int ak;
  int al;
  int am;
  int an;
  int ao;
  int ap;
  int aq;
  int ar;
  int as;
  int at;
  int au;
  int av;
  int aw;
  int ax;
  int ay;
  int az;
  int ba;
  int bb;
  int bc;
  int bd;
  int be;
  int bf;
  int bg;
  int bh;
  int bi;
  int *d(a, bool) {
    if (e)
      return &ae;
    a bj;
    bj.c("");
    if (f)
      return &af;
    bj.c("");
    if (e)
      return &ag;
    bj.c("");
    if (f)
      return &ah;
    bj.c("");
    if (e)
      return &ai;
    bj.c("");
    if (ad)
      return &aj;
    bj.c("");
    if (ac)
      return &ak;
    bj.c("");
    if (z)
      return &al;
    bj.c("");
    if (y)
      return &am;
    bj.c("");
    if (x)
      return &an;
    bj.c("");
    if (w)
      return &ao;
    bj.c("");
    if (ab)
      return &ap;
    bj.c("");
    if (v)
      return &aq;
    bj.c("");
    if (u)
      return &ar;
    bj.c("");
    if (t)
      return &as;
    bj.c("");
    if (s)
      return &at;
    bj.c("");
    if (r)
      return &au;
    bj.c("");
    if (q)
      return &av;
    bj.c("");
    if (aa)
      return &aw;
    bj.c("");
    if (p)
      return &ax;
    bj.c("");
    if (o)
      return &ay;
    bj.c("");
    if (n)
      return &az;
    bj.c("");
    if (m)
      return &ba;
    bj.c("");
    if (l)
      return &bb;
    bj.c("");
    if (k)
      return &bc;
    bj.c("");
    if (j)
      return &bd;
    bj.c("");
    if (i)
      return &be;
    bj.c("");
    if (h)
      return &bf;
    bj.c("");
    if (g)
      return &bg;
    if (f)
      return &bh;
    {
      a bj;
      e = bj.c("");
    }
    return &bi;
  }
} b;
Comment 1 Jakub Jelinek 2018-01-08 11:03:49 UTC
Started with r254919.
Comment 2 Martin Liška 2018-01-09 15:04:24 UTC
Let me take a look.
Comment 3 Martin Liška 2018-01-10 12:47:03 UTC
Nice, fixed by https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83532#c1.
Honza please test-case which I'm going to attach to the PR.
Comment 4 Martin Liška 2018-01-10 12:47:28 UTC
Created attachment 43087 [details]
test-case
Comment 5 Jan Hubicka 2018-01-11 17:46:33 UTC
Author: hubicka
Date: Thu Jan 11 17:46:01 2018
New Revision: 256544

URL: https://gcc.gnu.org/viewcvs?rev=256544&root=gcc&view=rev
Log:
	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.


Added:
    trunk/gcc/testsuite/g++.dg/torture/pr83718.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-inline.c
Comment 6 Jan Hubicka 2018-01-11 18:05:50 UTC
Fixed.