The following valid code snippet triggers an ICE on trunk when compiled with
"-O3" on i686-pc-linux-gnu and x86_64-unknown-linux-gnu:

===================================================
template<int> struct A
{
  void foo(void(*)(A));
  void bar(void(*f)(A)) { foo(f); foo(f); }
};

template<int N> inline void FOO(A<N> a)
{
  a.foo(0);
}

extern template void FOO(A<0>);

void BAR()
{
  A<0> a;
  FOO(a);
  a.bar(FOO);
}
===================================================

bug.cc:19:1: error: Inline clone with address taken
void FOO(A<N>) [with int N = 0]/5(-1) @0x40228780 (asm: _Z3FOOILi0EEv1AIXT_EE)
(inline copy in void BAR()/0) availability:local analyzed 12 time, 11 benefit 3
size, 2 benefit address_taken body local finalized inlinable
  called by: void BAR()/0 (1.00 per call) (inlined) (can throw external) 
  calls: void A<<anonymous> >::foo(void (*)(A<<anonymous> >)) [with int
<anonymous> = 0, A<<anonymous> > = A<0>]/3 (1.00 per call) (can throw external) 
  References: 
  Refering this function:  fn:void A<<anonymous> >::bar(void (*)(A<<anonymous>
>)) [with int <anonymous> = 0, A<<anonymous> > = A<0>]/4 (addr) fn:void
A<<anonymous> >::bar(void (*)(A<<anonymous> >)) [with int <anonymous> = 0,
A<<anonymous> > = A<0>]/4 (addr)
bug.cc:19:1: internal compiler error: verify_cgraph_node failed
Please submit a full bug report, [etc.]

This is probably related to PR 44121.


-- 
           Summary: [4.6 Regression] ICE: Inline clone with address taken
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code, monitored
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44206

Reply via email to