On Tue, Nov 5, 2024 at 8:30 PM Junwang Zhao <zhjwpku@gmail.com> wrote:
>
>
> Thanks for the bounds preserve solution, I just looked at 0002,
>
> + if (astate->arraystate != NULL)
> + {
> + memcpy(astate->arraystate->dims, dims, ndim * sizeof(int));
> + memcpy(astate->arraystate->lbs, lbs, ndim * sizeof(int));
> + Assert(ndim == astate->arraystate->ndims);
> + }
>
> It seems to me we only need to set astate->arraystate->lbs[0] = lbs[0] ?
>
yes.
> + memcpy(astate->arraystate->dims, dims, ndim * sizeof(int));
thinking about it, this is wrong. we should just do Assert
for(int i = 0; i < ndim; i++)
{
Assert(astate->arraystate->dims[i] == dims[i]);
}
or just remove
memcpy(astate->arraystate->dims, dims, ndim * sizeof(int));