From: Keith Randall Date: Thu, 10 Apr 2014 14:59:46 +0000 (-0700) Subject: cmd/6g: nacl: zero odd multiple of widthptr correctly X-Git-Tag: go1.3beta1~127 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=bfbb2e827b3c86e0f85f7378667958d91726c928;p=gostls13.git cmd/6g: nacl: zero odd multiple of widthptr correctly LGTM=iant R=remyoudompheng, iant CC=golang-codereviews https://golang.org/cl/86270043 --- diff --git a/src/cmd/6g/ggen.c b/src/cmd/6g/ggen.c index 991783bc57..3d27fb2ab9 100644 --- a/src/cmd/6g/ggen.c +++ b/src/cmd/6g/ggen.c @@ -73,6 +73,14 @@ zerorange(Prog *p, vlong frame, vlong lo, vlong hi, uint32 *ax) p = appendpp(p, AMOVQ, D_CONST, 0, D_AX, 0); *ax = 1; } + if(cnt % widthreg != 0) { + // should only happen with nacl + if(cnt % widthptr != 0) + fatal("zerorange count not a multiple of widthptr %d", cnt); + p = appendpp(p, AMOVL, D_AX, 0, D_SP+D_INDIR, frame+lo); + lo += widthptr; + cnt -= widthptr; + } if(cnt <= 4*widthreg) { for(i = 0; i < cnt; i += widthreg) { p = appendpp(p, AMOVQ, D_AX, 0, D_SP+D_INDIR, frame+lo+i);