http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45973
Summary: NRVO gives incorrect location
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: debug
AssignedTo: [email protected]
ReportedBy: [email protected]
This test case comes from gdb bugzilla.
class foo
{
public:
int bar;
~foo(){};
};
foo f()
{
foo x;
x.bar = 1;
x.bar = x.bar;
return x;
};
int main()
{
f();
};
Compile with -g. Then, look at 'x' in the DWARF. I see:
<3><cf>: Abbrev Number: 15 (DW_TAG_variable)
<d0> DW_AT_name : x
<d2> DW_AT_decl_file : 1
<d3> DW_AT_decl_line : 10
<d4> DW_AT_type : <0x29>
<d8> DW_AT_location : 1 byte block: 52 (DW_OP_reg2)
I think this is missing a DW_OP_deref.
That is, I think reg2 points to the object, it doesn't hold the object.