https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102043

--- Comment #41 from Richard Biener <rguenth at gcc dot gnu.org> ---
-- random ideas dumping below --

so reading about ISO_Fortran_binding.h it seems to be that a base of the object
isn't readily available and making it available would require quite some
computation.

staying with the current scheme of simply piggy-backing on C [] operator
semantics which is, when facing a pointer that is being indexed, equivalent
to pointer arithmetic which _can_ advance to before the indexed pointer,
looks reasonable.

that rules out using ARRAY_REF for all accesses through a descriptor
(unless all strides are positive - not sure if it's worth special casing that
though).

it might be helpful to have a tree code providing CFI_address in an expanded
form with explicitely specified index, [low-bound,] stride per indexed
dimension and with the guarantee of CFI that the dimensions are independent
(non-overlapping elements).  I'd call it ELEMENT_SELECT_EXPR here, it would
not be a tcc_reference since it only computes an address that would need
to be dereferenced with a MEM_REF.  Since it would be variable-length it
doesn't nicely map to GIMPLE.  Lowering during gimplification would be
possible.  Note we already have a vehicle that should be usable for
the 1-dimensional case, namely TARGET_MEM_REF which allows variable
pointer offsetting with a scaled index.  Of course it would be somewhat
abusing this and dependence analysis doesn't play nicely with it either
AFAIK.  Going for selected ARRAY_REF -> POINTER_PLUS_EXPR + MEM_REF
lowering sounds like the way of least resistance, but then that's probably
backwards of what the OpenACC folks want to do.

Reply via email to