https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53927
--- Comment #18 from Eric Botcazou <ebotcazou at gcc dot gnu.org> --- > Jason suggested to change DW_AT_frame_base in order to make it equal to the > address of the FRAME object. I was not sure: > > 1) how to do it: location descriptions for all local variables would need > to be updated; > 2) whether it's safe to do this: what if optimizers move/duplicate this > FRAME object in the stack frame or do similar "disturbing" things? I'm not > familiar enough with optimization passes to estimate if it's likely: > feedback welcome. :-) > > I thought: why not make DW_AT_static_link compute the parent frame base > address from the current static link argument? Well, when generating > DW_AT_static_link for a nested subprogram, we do not know yet the offset > between the FRAME object and the frame base address. This is because nested > subprograms reach the back-end before their parent. Besides, see point 2: > are we only sure that such a constant offset exists? I think this is worth investigating though because it's conceptually much simpler than adding yet another indirection. And we should concentrate on -O0 (and -Og), we don't really care about what happens with aggressive optimization. I guess the question is: can we arrange to have a constant offset between the frame base and the FRAME object, "constant" meaning valid for every function but possibly target-dependent?