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++/55785] New: gcc4.5.2 incorrect line # of caller for destructor


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

             Bug #: 55785
           Summary: gcc4.5.2 incorrect line # of caller for destructor
    Classification: Unclassified
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: chihin.ko@oracle.com


Created attachment 29024
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29024
c++ test case

platform Solaris intel

build command
/net/gozo/sqe/tools/gcc/4.5.2/intel-S2/bin/g++   002.cc -g

(dbx) stop in stack::~stack
(dbx) run
Running: a.out
(process id 13901)
stopped in stack::~stack at line 73 in file "002.cc"
   73                            delete bottom;
stack::~stack(this = 0x8044c90) called from function reverse_name

(dbx) where
=>[1] stack::~stack(this = 0x8044c90), line 73 in "002.cc"
  [2] reverse_name(name = 0x80511dc "Honey"), line 77 in "002.cc"  <== should
be line 87
  [3] main(), line 96 in "002.cc"

gcc4.7 does not have this problem.

This is due to gcc4.5.2 compiler generate extra line 77 in line table:

a.out dwarfdump:

0x080510c8  [  84, 0] NS
0x080510e3  [  86, 0] NS
0x080510f4  [  87, 0] NS
0x080510f7  [  77, 0] NS  <== extra line 77
0x08051104  [  88, 0] NS
0x0805110c  [  77, 0] NS  <== extra
0x08051121  [  91, 0] NS

compare the address 0x080510fd of "call ~stack" down below, the extra line 77
in line table, mess up the address/line mapping when doing command "where".

   87                     return reverse;
0x080510f4: reverse_name+0x00b4:        movl     0xfffffff0(%ebp),%ebx
0x080510f7: reverse_name+0x00b7:        leal     0xffffffe8(%ebp),%eax
0x080510fa: reverse_name+0x00ba:        movl     %eax,(%esp)
0x080510fd: reverse_name+0x00bd:        call     ~stack [ 0x805102a, .-0xd3 ]
0x08051102: reverse_name+0x00c2:        movl     %ebx,%eax
   88                   }
0x08051104: reverse_name+0x00c4:        addl     $0x00000024,%esp
0x08051107: reverse_name+0x00c7:        popl     %ebx
0x08051108: reverse_name+0x00c8:        popl     %ebp
0x08051109: reverse_name+0x00c9:        ret      
0x0805110a: reverse_name+0x00ca:        movl     %eax,%ebx
0x0805110c: reverse_name+0x00cc:        leal     0xffffffe8(%ebp),%eax
0x0805110f: reverse_name+0x00cf:        movl     %eax,(%esp)
0x08051112: reverse_name+0x00d2:        call     ~stack [ 0x805102a, .-0xe8 ]
0x08051117: reverse_name+0x00d7:        movl     %ebx,%eax
0x08051119: reverse_name+0x00d9:        movl     %eax,(%esp)
0x0805111c: reverse_name+0x00dc:        call     _Unwind_Resume [PLT]   [
0x8050d64, .-0x3b8 ]
   89


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