summary refs log tree commit diff
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-17 19:50:26 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-17 19:50:26 -0400
commit4a2c4d63f99ee3a2d7e124c6a979165b71f3367c (patch)
tree1aba62d02fbdacdf092da0b5b4222774b01f79b3
parentc298820211351716c22198c7b4e6c7c0ea664c64 (diff)
downloadroux-4a2c4d63f99ee3a2d7e124c6a979165b71f3367c.tar.gz
fix memcpy bug
-rw-r--r--lisc/isel.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lisc/isel.c b/lisc/isel.c
index 1879e72..e69e8eb 100644
--- a/lisc/isel.c
+++ b/lisc/isel.c
@@ -683,11 +683,11 @@ isel(Fn *fn)
 			break;
 	selpar(fn, b->ins, i);
 	i0 = i;
-	n = b->nins - (i0-b->ins);
+	n = b->nins - (i-b->ins);
 	b->nins = n + (curi-insb);
 	i = alloc(b->nins * sizeof i[0]);
 	memcpy(i, insb, (curi-insb) * sizeof i[0]);
-	memcpy(&i[n], i0, n * sizeof i[0]);
+	memcpy(&i[curi-insb], i0, n * sizeof i[0]);
 	free(b->ins);
 	b->ins = i;