https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83619

            Bug ID: 83619
           Summary: [8 Regression] ICE in inliner: caller edge count does
                    not match BB count
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: hubicka at gcc dot gnu.org, marxin at gcc dot gnu.org
  Target Milestone: ---

Starting from well-known revision r255103, we ICE on:

$ cat ice.ii
int a;
class d
{
public:
  virtual unsigned c ();
};
class e;
class i
{
  void h ();

public:
  void
  operator= (e *f)
  {
    j<int>::c (f);
    h ();
  }
  template <class> struct j
  {
    static void
    c (e *g)
    {
      g->c ();
    }
  };
};
class k;
class l
{
public:
  l (int);
  k *operator-> ();
};
class e : public d
{
};
class m final : e
{
  unsigned c ();
};
class k
{
public:
  virtual int o (e *) = 0;
};
class H : d, k
{
  int o (e *);
  i n;
};
unsigned
m::c ()
{
  l b = 0;
  b->o (this);
  return a;
}
int
H::o (e *p)
{
  n = p;
  return a;
}

$ g++ -O3 ice.ii -c
ice.ii: In static member function ‘static void i::j< <template-parameter-1-1>
>::c(e*)’:
ice.ii:24:8: warning: invalid use of incomplete type ‘class e’
       g->c ();
        ^~
ice.ii:7:7: note: forward declaration of ‘class e’
 class e;
       ^
ice.ii: In member function ‘virtual unsigned int m::c()’:
ice.ii:56:8: error: caller edge count does not match BB count
   b->o (this);
   ~~~~~^~~~~~
edge count: 1717986906 (estimated locally)
 bb count: 858993456 (estimated locally)
_ZN1m1cEv/2 (virtual unsigned int m::c()) @0x7f49e9e94170
  Type: function definition analyzed
  Visibility: externally_visible public virtual
  Address is taken.
  References: _ZN1m1cEv/2 (addr)_ZThn8_N1H1oEP1e/5 (addr)_ZN1m1cEv/2
(addr)_ZThn8_N1H1oEP1e/5 (addr)
  Referring: _ZTV1m/8 (addr)_ZN1m1cEv/2 (addr)_ZN1m1cEv/2 (addr)
  Availability: available
  First run: 0
  Function flags: count: 1073741826 (estimated locally) body
indirect_call_target
  Called by: virtual unsigned int m::c()/2 (0 (estimated locally),0.00 per
call) (can throw external) virtual unsigned int m::c()/2 (0 (estimated
locally),0.00 per call) (can throw external) virtual unsigned int m::c()/2
(1717986906 (estimated locally),1.60 per call) (can throw external) 
  Calls: virtual unsigned int m::c()/2 (0 (estimated locally),0.00 per call)
(can throw external) virtual unsigned int m::c()/2 (0 (estimated locally),0.00
per call) (can throw external) virtual unsigned int m::c()/2 (1717986906
(estimated locally),1.60 per call) (can throw external) void i::h()/23 (0
(estimated locally),0.00 per call) (can throw external) k* l::operator->()/21
(0 (estimated locally),0.00 per call) (can throw external) l::l(int)/20 (0
(estimated locally),0.00 per call) (can throw external) void i::h()/23 (0
(estimated locally),0.00 per call) (can throw external) k* l::operator->()/21
(0 (estimated locally),0.00 per call) (can throw external) l::l(int)/20 (0
(estimated locally),0.00 per call) (can throw external) void i::h()/23
(858993456 (estimated locally),0.80 per call) (can throw external) k*
l::operator->()/21 (1073741825 (estimated locally),1.00 per call) (can throw
external) l::l(int)/20 (1073741825 (estimated locally),1.00 per call) (can
throw external) 
   Indirect call(0 (estimated locally),0.00 per call) (can throw external) 
   Indirect call(0 (estimated locally),0.00 per call) (can throw external) 
   Indirect call(214748365 (estimated locally),0.20 per call) (can throw
external) 
during IPA pass: inline
ice.ii:56:8: internal compiler error: verify_cgraph_node failed
0xb05f7d cgraph_node::verify_node()
        ../../gcc/cgraph.c:3552
0xaf978c symtab_node::verify()
        ../../gcc/symtab.c:1204
0x10e168c optimize_inline_calls(tree_node*)
        ../../gcc/tree-inline.c:5108
0x1aaea6b inline_transform(cgraph_node*)
        ../../gcc/ipa-inline-transform.c:682
0xf1f807 execute_one_ipa_transform_pass
        ../../gcc/passes.c:2239
0xf1f991 execute_all_ipa_transforms()
        ../../gcc/passes.c:2281
0xb13788 cgraph_node::expand()
        ../../gcc/cgraphunit.c:2132
0xb13df7 expand_all_functions
        ../../gcc/cgraphunit.c:2275
0xb1494b symbol_table::compile()
        ../../gcc/cgraphunit.c:2623
0xb14bc0 symbol_table::finalize_compilation_unit()
        ../../gcc/cgraphunit.c:2716

I'll try to take a look. I can however refuse that there's a usage of
uninitialized value.

Reply via email to