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 c++/40382] New: Useless instructions in destructor


Compile following simple class with -O2 -Os -mthumb -fpic

class base {
  virtual ~base();
};

base::~base()
{
}

The destructor of this class should do nothing, just return is enough. But gcc
generats following codes for D1 version destructor:

        ldr     r3, .L3
        ldr     r1, .L3+4
        add     r3, pc
        ldr     r2, [r3, r1]
        add     r2, r2, #8
        str     r2, [r0]
        bx      lr
.L3:
        .word   _GLOBAL_OFFSET_TABLE_-(.LPIC0+4)
        .word   _ZTV4base(GOT)


-- 
           Summary: Useless instructions in destructor
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: carrot at google dot com
 GCC build triplet: i686-linux
  GCC host triplet: i686-linux
GCC target triplet: arm-eabi


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


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