about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Src/params.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/Src/params.c b/Src/params.c
index 63e1dc75c..6c07396b2 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -1727,8 +1727,13 @@ setarrvalue(Value v, char **val)
 		 v->pm->nam, 0);
 	    return;
 	}
-	if (v->inv && unset(KSHARRAYS))
-	    v->start--, v->end--;
+	if (v->inv && unset(KSHARRAYS)) {
+	    if (v->start > 0)
+		v->start--;
+	    v->end--;
+	}
+	if (v->end < v->start)
+	    v->end = v->start;
 	q = old = v->pm->gets.afn(v->pm);
 	n = arrlen(old);
 	if (v->start < 0) {