https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108581
Paul Thomas <pault at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed| |2023-03-28 CC| |pault at gcc dot gnu.org --- Comment #2 from Paul Thomas <pault at gcc dot gnu.org> --- Dear Saito-san, Thank you for the report. Confirmed on 13.0.1. The fault persists even when the limits are changed (I thought that the zeros might be the cause of the problem). Regards Paul For the record, the error occurs in creating the array descriptor for the transfer to the library write function: { integer(kind=8) D.4307; integer(kind=8) D.4308; integer(kind=8) D.4309; struct array01_character(kind=1) parm.12; integer(kind=8) D.4316; _F.a = _F.a; D.4307 = a.dim[0].lbound; D.4308 = a.dim[0].ubound; D.4309 = (integer(kind=8)) y; parm.12.span = NON_LVALUE_EXPR <_F.a>; parm.12.dtype = {.elem_len=(unsigned long) _F.a, .rank=1, .type=6}; D.4316 = a.dim[0].stride; parm.12.dim[0].lbound = 1; parm.12.dim[0].ubound = (1 - D.4307) + D.4308; parm.12.dim[0].stride = NON_LVALUE_EXPR <D.4316>; parm.12.data = a.data + (sizetype) (((D.4307 - a.dim[0].lbound) * D.4316 + (D.4309 - a.dim[1].lbound) * a.dim[1].stride) * (integer(kind=8)) SAVE_EXPR <D.4318>); parm.12.offset = -NON_LVALUE_EXPR <D.4316>; _gfortran_transfer_array_write (&dt_parm.11, &parm.12, 1, _F.a); } I suspect that SAVE_EXPR <D.4318> is returning zero so that the data pointer is independent of y. The first write statement scalarizes the operation and makes use of the 'span' field of 'a', rather than D.4318.