On Tue, Oct 07, 2014 at 10:08:23AM +0200, Pierre-Marie de Rodat wrote: > >>gcc/fortran/ > >> * trans-types.c (gfc_get_array_descr_info): Use PLACEHOLDER_EXPR nodes > >> instead of VAR_DECL ones in type-related expressions. Remove base_decl > >> initialization. > > > >Ugh, I must say I don't like PLACEHOLDER_EXPRs at all. > > Why so? I know that as far as supported front-ends are concerned, > PLACEHOLDE_EXPR nodes are used only in GNAT, but it seems to me they > describe the best what object the bound/stride/allocated/associated > expressions (self-)reference.
But isn't there a risk that you will have PLACEHOLDER_EXPRs (likely for Ada only) in some trees not constructed by the langhook? I mean, DW_OP_push_object_address isn't meaningful in all DWARF contexts, in some it is forbidden, in others there is really no object to push, and as implemented, you emit DW_OP_push_object_address (which emits the address of a context related particular object) for any kind of PLACEHOLDER_EXPR with RECORD_TYPE. Thus, I'd feel safer, even if you decide to use a PLACEHOLDER_EXPR, that the translation of that to DW_OP_push_object_address would be done only if the PLACEHOLDER_EXPR is equal to some global variable, normally NULL, and only changed temporarily while emitting loc for the array descriptor. But then IMHO a DEBUG_EXPR_DECL is better. That said, if Jason is fine with the patchset as is, I can live with it, as other FEs don't use PLACEHOLDER_EXPRs, worst case it will affect Ada only. Also, please verify that with your patch the generated debug info for some Fortran arrays is the same. Jakub