https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109345
Paul Thomas <pault at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pault at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |pault at gcc dot gnu.org --- Comment #2 from Paul Thomas <pault at gcc dot gnu.org> --- Created attachment 59551 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59551&action=edit "Fix" for this PR This patch shows where the problem is. Scalarised array references use the string length directly, whereas for some reason explicit array references use the span and this not being set correctly. .__tmp_CHARACTER_0_1 = var->_len; // Sets it to KIND D.5013 = ubound.22; parm.32.span = var->_vptr->_size; parm.32.dtype = {.elem_len=8, .version=0, .rank=1, .type=10}; D.5020 = stride.23; parm.32.dim[0].lbound = 1; parm.32.dim[0].ubound = D.5013; parm.32.dim[0].stride = NON_LVALUE_EXPR <D.5020>; parm.32.data = (void *) &(*var.0)[0]; parm.32.offset = -NON_LVALUE_EXPR <D.5020>; __tmp_CHARACTER_0_1 = parm.32; __tmp_CHARACTER_0_1.dtype = {.elem_len=(unsigned long) .__tmp_CHARACTER_0_1, .version=0, .rank=1, .type=6}; __tmp_CHARACTER_0_1.span = .__tmp_CHARACTER_0_1; // Effect of the fix { struct __st_parameter_dt dt_parm.27; This will not be correct if the KIND of the unlimited polymorphic payload is 4. Easily fixed. I will attend to it tonight. Paul