https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102619
Mikael Morin <mikael at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mikael at gcc dot gnu.org --- Comment #8 from Mikael Morin <mikael at gcc dot gnu.org> --- The reason why the variable is not represented with an array descriptor is the interface mapping mechanism to evaluate dummy array bounds. gfc_add_interface_mapping replaces the normal variable decl with a descriptorless (GFC_ARRAY_TYPE_P == 1) array. The rank for those is GFC_TYPE_ARRAY_RANK, which is #defined to (TYPE_LANG_SPECIFIC(node)->rank). And lang_type declares the rank field with: int rank, corank; so compile-time only rank. gfc_set_interface_mapping_bounds uses a loop bounded by GFC_TYPE_ARRAY_RANK, so it does nothing if the rank is -1 as with assumed rank. So we expect a regular array descriptor from which we can get the runtime rank, and we get a descriptorless array of rank -1 with unset bounds. No wonder it doesn't work.