https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100960
Bug ID: 100960 Summary: var-tracking: parameter location in subregister not tracked Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug Assignee: unassigned at gcc dot gnu.org Reporter: stefansf at linux dot ibm.com Target Milestone: --- Target: s390x-*-* Created attachment 50960 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50960&action=edit var-tracking dump On IBM Z we often have the case that debug information for a parameter points to the entry value only although the value is held in a register, too. __attribute__((noinline, noclone)) void f1 (int x) { __asm volatile ("" : "+r" (x) : : "memory"); } __attribute__((noinline, noclone)) int f2 (int x) { f1 (x); return x; // (*) } __attribute__((noinline, noclone)) int f3 (int x) { f2 (x); return 3; } int main () { f3 (42); return 0; } 0x1000600 <f2> stmg %r12,%r15,96(%r15) 0x1000606 <f2+6> lay %r15,-160(%r15) 0x100060c <f2+12> lgr %r12,%r2 0x1000610 <f2+16> brasl %r14,0x10005f8 <f1> 0x1000616 <f2+22> lgr %r2,%r12 0x100061a <f2+26> lmg %r12,%r15,256(%r15) 0x1000620 <f2+32> br %r14 At program point (*) debug information for parameter x points to the entry value only. Thus it gets neglected that the value was moved to call-saved register r12 prior function call f1. Having a look at var-tracking this seems to boil down to the fact that register r2 is saved (lgr %r12,%r2) and restored (lgr %r2,%r12) in DI mode whereas parameter x has only SI mode and the relation is not tracked. In other words, for parameter x var-tracking is looking after the function call f1 for an SI value and doesn't find it although it is a subvalue held in register r12. Is this a known deficiency or am I missing something?