Bug 45973 - NRVO gives incorrect location
Summary: NRVO gives incorrect location
Status: RESOLVED DUPLICATE of bug 44731
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-11 22:00 UTC by Tom Tromey
Modified: 2010-10-11 22:16 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Tromey 2010-10-11 22:00:15 UTC
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.
Comment 1 Andrew Pinski 2010-10-11 22:05:17 UTC
I think this is the same as PR 44731.
Comment 2 Tom Tromey 2010-10-11 22:16:06 UTC
Thanks.  I thought there was another bug for this, but I didn't find it.

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