Bug 55785 - gcc4.5.2 incorrect line # of caller for destructor
Summary: gcc4.5.2 incorrect line # of caller for destructor
Status: RESOLVED DUPLICATE of bug 49951
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.5.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-22 03:49 UTC by chihin ko
Modified: 2012-12-22 04:00 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
c++ test case (756 bytes, text/x-c++src)
2012-12-22 03:49 UTC, chihin ko
Details

Note You need to log in before you can comment on or make changes to this bug.
Description chihin ko 2012-12-22 03:49:55 UTC
Created attachment 29024 [details]
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
Comment 1 Andrew Pinski 2012-12-22 04:00:07 UTC
This was fixed in 4.5.4 and a dup of bug 49951.

*** This bug has been marked as a duplicate of bug 49951 ***