Hi,
Two loops in yacc/lalr.c can be converted into memcpy().
I quickly tested this on i386 and amd64 against rcs/date.y
and the output matched y.tab.c of unpatched yacc.
- Michael
Index: lalr.c
===================================================================
RCS file: /cvs/src/usr.bin/yacc/lalr.c,v
retrieving revision 1.18
diff -u -p -u -r1.18 lalr.c
--- lalr.c 11 Dec 2015 20:25:47 -0000 1.18
+++ lalr.c 5 Jan 2017 08:56:11 -0000
@@ -324,8 +324,7 @@ initialize_F(void)
if (nedges) {
reads[i] = rp = NEW2(nedges + 1, short);
- for (j = 0; j < nedges; j++)
- rp[j] = edge[j];
+ memcpy(rp, edge, nedges * 2);
rp[nedges] = -1;
nedges = 0;
@@ -403,8 +402,7 @@ build_relations(void)
if (nedges) {
includes[i] = shortp = NEW2(nedges + 1, short);
- for (j = 0; j < nedges; j++)
- shortp[j] = edge[j];
+ memcpy(shortp, edge, nedges * 2);
shortp[nedges] = -1;
}
}