diff --git a/src/array.c b/src/array.c index e073727538a56..5ae407d7dbe87 100644 --- a/src/array.c +++ b/src/array.c @@ -831,7 +831,9 @@ STATIC_INLINE void jl_array_del_at_beg(jl_array_t *a, size_t idx, size_t dec, nbtotal++; if (idx > 0) memmove(newdata, olddata, nb1); - memmove(newdata + nb1, olddata + nb1 + nbdec, nbtotal - nb1); + // Move the rest of the data if the offset changed + if (newoffs != offset) + memmove(newdata + nb1, olddata + nb1 + nbdec, nbtotal - nb1); a->data = newdata; } else {