http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46724

--- Comment #6 from Alexandre Oliva <aoliva at gcc dot gnu.org> 2010-12-17 
06:19:30 UTC ---
Created attachment 22792
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22792
Patch I'm testing that fixes the bug

Here's what I meant.  It does fix the bug at hand, and (surprisingly) we don't
end up emitting debug info for the artificial parameter.  Tracking it is enough
to fix the location info for the variable that maps to the result.  It looks
like this:

        .byte   0x8     # uleb128 0x8; (DIE (0x15b) DW_TAG_variable)
        .ascii "a2\0"   # DW_AT_name
        .byte   0x1     # DW_AT_decl_file
(../../gcc/testsuite/gcc.dg/guality/nrv-1.c)
        .byte   0x10    # DW_AT_decl_line
        .4byte  0xf5    # DW_AT_type
        .4byte  .LLST1  # DW_AT_location

.LLST1:
        .8byte  .LVL0   # Location list begin address (*.LLST1)
        .8byte  .LVL1-1 # Location list end address (*.LLST1)
        .2byte  0x2     # Location expression size
        .byte   0x72    # DW_OP_breg2
        .byte   0       # sleb128 0
        .8byte  0       # Location list terminator begin (*.LLST1)
        .8byte  0       # Location list terminator end (*.LLST1)

The range covers the entire function.  I haven't looked into why we don't
reduce the single-entry entire-function location list to a simpler location.

Reply via email to