https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87885
Bug ID: 87885 Summary: ICE in release_ssa_name_fn with -fprofile-report Product: gcc Version: 9.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: marxin at gcc dot gnu.org Target Milestone: --- Starting from r247882 I see: $ ./xgcc -B. /tmp/ice.ii -c -fprofile-report -O -c -Wall during GIMPLE pass: fre /tmp/ice.ii: In function ‘void ai()’: /tmp/ice.ii:43:6: internal compiler error: Segmentation fault 43 | void ai() { | ^~ 0x1466f7e crash_signal /home/marxin/Programming/gcc/gcc/toplev.c:325 0x7ffff6bc310f ??? /usr/src/debug/glibc-2.27-6.1.x86_64/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0 0x153c78f estimate_move_cost(tree_node*, bool) /home/marxin/Programming/gcc/gcc/tree-inline.c:3780 0x153d2b3 estimate_num_insns(gimple*, eni_weights*) /home/marxin/Programming/gcc/gcc/tree-inline.c:4087 0x14dc9aa gimple_account_profile_record /home/marxin/Programming/gcc/gcc/tree-cfg.c:8811 0xd63ddd account_profile_record(profile_record*, int) /home/marxin/Programming/gcc/gcc/cfghooks.c:1475 0x12eccac check_profile_consistency /home/marxin/Programming/gcc/gcc/passes.c:1757 $ cat ice.ii template <typename> class a {}; template <typename, typename> class b; template <typename> struct c; template <typename g> struct c<a<g>> { using d = a<g>; using e = g; using f = long; static e aa(d, f); }; struct h : c<a<int>> {}; struct i { struct j { int k; j(j &&) { k = int(); } }; struct l : a<int>, j {}; i(i &&) = default; ~i() { long ab = m.k; m.k ? h::aa(m, ab) : int(); } l m; }; class n : i { public: n(long); }; class q { public: template <typename o, typename p> q(o, o, p); n ae() { { n r(2); return r; } } }; template <typename s, typename t, typename af> void operator<<(b<t, af>, s p2) { p2.ae(); } template <typename, typename> class b {}; double ah; void ai() { q aj(ah, ah, ai); b<int, int> ak; ak << aj; } The problem is that we call estimate_run_insns for a gimple statement that has a SSA NAME in free list