This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/70804] New: Missed tail-call


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

            Bug ID: 70804
           Summary: Missed tail-call
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ramana at gcc dot gnu.org
  Target Milestone: ---

Given. 


struct E {
  virtual ~E() { destroy(); }
  virtual E *clone() = 0;
  void destroy();

};

struct B: public E {
  virtual ~B() {}
  virtual B *clone() { return 0; }
  virtual void bar() {}
};


void f(void) { B b; }

Notice the missing tail call to E:destroy from f. 

        .file   "m.cpp"
        .section       
.text._ZN1B5cloneEv,"axG",%progbits,_ZN1B5cloneEv,comdat
        .align  2
        .p2align 3,,7
        .weak   _ZN1B5cloneEv
        .type   _ZN1B5cloneEv, %function
_ZN1B5cloneEv:
.LFB8:
        .cfi_startproc
        mov     x0, 0
        ret
        .cfi_endproc
.LFE8:
        .size   _ZN1B5cloneEv, .-_ZN1B5cloneEv
        .section        .text._ZN1B3barEv,"axG",%progbits,_ZN1B3barEv,comdat
        .align  2
        .p2align 3,,7
        .weak   _ZN1B3barEv
        .type   _ZN1B3barEv, %function
_ZN1B3barEv:
.LFB9:
        .cfi_startproc
        ret
        .cfi_endproc
.LFE9:
        .size   _ZN1B3barEv, .-_ZN1B3barEv
        .section        .text._ZN1BD2Ev,"axG",%progbits,_ZN1BD5Ev,comdat
        .align  2
        .p2align 3,,7
        .weak   _ZN1BD2Ev
        .type   _ZN1BD2Ev, %function
_ZN1BD2Ev:
.LFB5:
        .cfi_startproc
        ldr     x1, .LC0
        str     x1, [x0]
        b       _ZN1E7destroyEv
        .cfi_endproc
.LFE5:
        .size   _ZN1BD2Ev, .-_ZN1BD2Ev
        .align  3
.LC0:
        .xword  _ZTV1E+16
        .weak   _ZN1BD1Ev
_ZN1BD1Ev = _ZN1BD2Ev
        .section        .text._ZN1BD0Ev,"axG",%progbits,_ZN1BD5Ev,comdat
        .align  2
        .p2align 3,,7
        .weak   _ZN1BD0Ev
        .type   _ZN1BD0Ev, %function
_ZN1BD0Ev:
.LFB7:
        .cfi_startproc
        stp     x19, x30, [sp, -16]!
        .cfi_def_cfa_offset 16
        .cfi_offset 19, -16
        .cfi_offset 30, -8
        ldr     x1, .LC1
        mov     x19, x0
        str     x1, [x0]
        bl      _ZN1E7destroyEv
        mov     x0, x19
        ldp     x19, x30, [sp], 16
        .cfi_restore 30
        .cfi_restore 19
        .cfi_def_cfa_offset 0
        b       _ZdlPv
        .cfi_endproc
.LFE7:
        .size   _ZN1BD0Ev, .-_ZN1BD0Ev
        .align  3
.LC1:
        .xword  _ZTV1E+16
        .text
        .align  2
        .p2align 3,,7
        .global _Z1fv
        .type   _Z1fv, %function
_Z1fv:
.LFB10:
        .cfi_startproc
        str     x30, [sp, -32]!
        .cfi_def_cfa_offset 32
        .cfi_offset 30, -32
        ldr     x1, .LC2
        add     x0, sp, 32
        str     x1, [x0, -8]!
        bl      _ZN1E7destroyEv
        ldr     x30, [sp], 32
        .cfi_restore 30
        .cfi_def_cfa_offset 0
        ret
        .cfi_endproc
.LFE10:
        .size   _Z1fv, .-_Z1fv
        .align  3
.LC2:
        .xword  _ZTV1E+16
        .weak   _ZTS1E
        .section        .rodata._ZTS1E,"aG",%progbits,_ZTS1E,comdat
        .align  3
        .type   _ZTS1E, %object
        .size   _ZTS1E, 3
_ZTS1E:
        .string "1E"
        .weak   _ZTI1E
        .section        .rodata._ZTI1E,"aG",%progbits,_ZTI1E,comdat
        .align  3
        .type   _ZTI1E, %object
        .size   _ZTI1E, 16
_ZTI1E:
        .xword  _ZTVN10__cxxabiv117__class_type_infoE+16
        .xword  _ZTS1E
        .weak   _ZTV1E
        .section        .rodata._ZTV1E,"aG",%progbits,_ZTV1E,comdat
        .align  3
        .type   _ZTV1E, %object
        .size   _ZTV1E, 40
_ZTV1E:
        .xword  0
        .xword  _ZTI1E
        .xword  0
        .xword  0
        .xword  __cxa_pure_virtual

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]