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

--- Comment #6 from anlauf at gcc dot gnu.org ---
Workaround: add

    contiguous :: u, v

to force generation of a proper temporary.

The dump-tree looks really fishy for the subroutine:

    {
      integer(kind=8) D.4689;
      struct array01_real(kind=4) parm.9;
      integer(kind=8) D.4696;

      D.4689 = ubound.0;
      parm.9.span = 4;
      parm.9.dtype = {.elem_len=4, .version=0, .rank=1, .type=3};
      D.4696 = stride.1;
      parm.9.dim[0].lbound = 1;
      parm.9.dim[0].ubound = D.4689;
      parm.9.dim[0].stride = NON_LVALUE_EXPR <D.4696>;
      parm.9.data = (void *) u.0;
      parm.9.offset = -NON_LVALUE_EXPR <D.4696>;
      _gfortran_transfer_array_write (&dt_parm.8, &parm.9, 4, 0);
    }

Without generating a temporary, this cannot work, as the main has:

...
    parm.12.span = 8;
    parm.12.dtype = {.elem_len=8, .version=0, .rank=1, .type=4};
    parm.12.dim[0].lbound = 1;
    parm.12.dim[0].ubound = 4;
    parm.12.dim[0].stride = 1;
    parm.12.data = (void *) &x.phi[0];
    parm.12.offset = -1;
...

so all of span, elem_len, and data disagree with expectations.

Reply via email to