[Bug c++/58198] New: duplicate codes generated for variant function and base function
chihin.ko at oracle dot com
gcc-bugzilla@gcc.gnu.org
Tue Aug 20 03:28:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58198
Bug ID: 58198
Summary: duplicate codes generated for variant function and
base function
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: chihin.ko at oracle dot com
Created attachment 30675
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30675&action=edit
test case
This problem was fixed after g++ 4.4, I file this bug is only for book keeping.
test case was attached.
pirandello 1017> nm a.out | grep mybase
0000000000400528 T _ZN6mybase10mybasefuncEv
000000000040054e T _ZN6mybaseC1Ev <=== base function
000000000040053a T _ZN6mybaseC2Ev <=== variant function
base function (_ZN6mybaseC1Ev) and variant function (_ZN6mybaseC2Ev) should
have same addresses, but they're not.
Use gdb to debug a.out, shows bpt stop in variant function instead of base
function:
(gdb) b mybase::mybase
Breakpoint 1 at 0x400542: file base.cc, line 21. (2 locations)
(gdb) run
Starting program:
/net/benjamin2.us.oracle.com/export/ws/jeanko/dinstall/maxirun/intel-Linux/pirandello-chko/results/Customlist_list.master.maxi/gplus_base.dbx,gcc/a.out
Breakpoint 1, mybase (this=0x7fff1343ed50) at base.cc:21
21 mybaseint = 5555;
(gdb) disassemb $pc
Dump of assembler code for function mybase:
0x000000000040053a <mybase+0>: push %rbp
0x000000000040053b <mybase+1>: mov %rsp,%rbp
0x000000000040053e <mybase+4>: mov %rdi,-0x8(%rbp)
0x0000000000400542 <mybase+8>: mov -0x8(%rbp),%rax
0x0000000000400546 <mybase+12>: movl $0x15b3,(%rax)
0x000000000040054c <mybase+18>: leaveq
0x000000000040054d <mybase+19>: retq
End of assembler dump.
(gdb)
# disassemble base function address shows both functions has exact same codes
(gdb) disassemb 0x40054e
Dump of assembler code for function mybase:
0x000000000040054e <mybase+0>: push %rbp
0x000000000040054f <mybase+1>: mov %rsp,%rbp
0x0000000000400552 <mybase+4>: mov %rdi,-0x8(%rbp)
0x0000000000400556 <mybase+8>: mov -0x8(%rbp),%rax
0x000000000040055a <mybase+12>: movl $0x15b3,(%rax)
0x0000000000400560 <mybase+18>: leaveq
0x0000000000400561 <mybase+19>: retq
End of assembler dump.
(gdb)
More information about the Gcc-bugs
mailing list