[Bug debug/93888] Incorrect DW_AT_location generated for copy-constructed function argument
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Mar 3 12:20:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93888
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The location looks fine.
The issue is that the func1_k argument is turned into a reference
(DECL_BY_REFERENCE).
In the *.optimized dump we have:
const struct K & restrict func1_k;
...
K::K (&D.2368, &my_k);
# DEBUG func1_k => &D.2368
_8 = D.2368.m_storage[0];
_9 = _8 == 67;
<bb 3> :
<L3>:
_10 = _9;
<bb 4> :
# DEBUG func1_k => NULL
and in *.final:
(note 43 12 50 2 (var_location func1_k (plus:DI (reg/f:DI 6 bp)
(const_int -8 [0xfffffffffffffff8]))) NOTE_INSN_VAR_LOCATION)
which matches that, bp - 8 is what is passed to the copy constructor.
But for the func1_k VAR_DECL, we don't emit type of reference to const K, but
just use
.uleb128 0x10 # (DIE (0xfb) DW_TAG_formal_parameter)
.long 0x14c # DW_AT_abstract_origin
.long .LLST0 # DW_AT_location
and the abstract origin has type const K.
I guess we should mark such vars DECL_BY_REFERENCE if their abstract origin is
DECL_BY_REFERENCE.
More information about the Gcc-bugs
mailing list