https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104337
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Target| |x86_64-*-* Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- I will have a look. Note this is the inline copy of the result decl of 'c' which is the RESULT_DECL 'd' having an abstract origin of the VAR_DECL 'd'. This abstract origin is set by NRV: /* At this point we know that all the return statements return the same local which has suitable attributes for NRV. Copy debugging information from FOUND to RESULT if it will be useful. But don't set DECL_ABSTRACT_ORIGIN to point at another function. */ if (!DECL_IGNORED_P (found) && !(DECL_ABSTRACT_ORIGIN (found) && DECL_CONTEXT (DECL_ABSTRACT_ORIGIN (found)) != current_function_decl)) { DECL_NAME (result) = DECL_NAME (found); DECL_SOURCE_LOCATION (result) = DECL_SOURCE_LOCATION (found); DECL_ABSTRACT_ORIGIN (result) = DECL_ABSTRACT_ORIGIN (found); } but NRV runs _after_ the function was inlined and thus affects the inlined variables copy indirectly. We may adjust the abstract origin of a variable only at the point we create it, not further along the path since otherwise the (new) invariant that the abstract origin is always the ultimate origin cannot be maintained. The intent of what NRV does is OK I guess and it improves the debug experience. But I also notice we do SET_DECL_VALUE_EXPR (found, result); DECL_HAS_VALUE_EXPR_P (found) = 1; the code is there since the merge from tree-ssa which added tree-nrv.c. Jakub added the DECL_VALUE_EXPR in g:938650d8fddb878f623e315f0b7fd94b217efa96 and Jason added the abstract origin setting conditional in g:7716876bbd3a