[Bug debug/43053] New: DWARF info adds bogus const to 'this' argument
drow at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Feb 12 15:03:00 GMT 2010
Compile this code (from the GDB testsuite) with G++ (tested 4.4.3, trunk):
class foo {
public:
int overload1arg (char);
};
int main ()
{
foo foo_instance1;
return 0;
}
int foo::overload1arg (char arg) { arg = 0; return 2;}
Here's the relevant bit of debug info:
<2><2d>: Abbrev Number: 3 (DW_TAG_subprogram)
<2e> DW_AT_external : 1
<2f> DW_AT_name : (indirect string, offset: 0x59): overload1arg
<33> DW_AT_decl_file : 1
<34> DW_AT_decl_line : 3
<35> DW_AT_MIPS_linkage_name: (indirect string, offset: 0x0):
_ZN3foo12overload1argEc
<39> DW_AT_type : <0x4b>
<3d> DW_AT_declaration : 1
<3><3e>: Abbrev Number: 4 (DW_TAG_formal_parameter)
<3f> DW_AT_type : <0x52>
<43> DW_AT_artificial : 1
<3><44>: Abbrev Number: 5 (DW_TAG_formal_parameter)
<45> DW_AT_type : <0x58>
<1><94>: Abbrev Number: 12 (DW_TAG_subprogram)
<95> DW_AT_specification: <0x2d>
<99> DW_AT_decl_line : 13
<9a> DW_AT_low_pc : 0xe
<9e> DW_AT_high_pc : 0x25
<a2> DW_AT_frame_base : 0x38 (location list)
<a6> DW_AT_sibling : <0xc6>
<2><aa>: Abbrev Number: 13 (DW_TAG_formal_parameter)
<ab> DW_AT_name : (indirect string, offset: 0x66): this
<af> DW_AT_type : <0xc6>
<b3> DW_AT_artificial : 1
<b4> DW_AT_location : 2 byte block: 91 0 (DW_OP_fbreg: 0)
<2><b7>: Abbrev Number: 14 (DW_TAG_formal_parameter)
<b8> DW_AT_name : arg
<bc> DW_AT_decl_file : 1
<bd> DW_AT_decl_line : 13
<be> DW_AT_type : <0x58>
<c2> DW_AT_location : 2 byte block: 91 64 (DW_OP_fbreg: -28)
<1><c6>: Abbrev Number: 15 (DW_TAG_const_type)
<c7> DW_AT_type : <0x52>
The in-class declaration of foo::overload1arg function has two arguments, of
types <0x52> and <0x58>. The out of line version references that with
DW_AT_specification, but has argument types <0xc6> and <0x58>. The
specification has a foo * argument, the implementation has a foo * const
argument.
'this' can not be modified, so arguably the const is right. But it should be
consistent between the two DIEs.
--
Summary: DWARF info adds bogus const to 'this' argument
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Keywords: wrong-debug
Severity: normal
Priority: P3
Component: debug
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: drow at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43053
More information about the Gcc-bugs
mailing list