From e7a387585992a9378ba2f2319c2408c62a0b14e8 Mon Sep 17 00:00:00 2001 From: Emil Skoeldberg Date: Thu, 26 Apr 2018 18:11:55 +0100 Subject: Fix compiler warnings. Compiler warned about comparison between signed and unsigned values. --- amd64/isel.c | 4 ++-- amd64/sysv.c | 2 +- arm64/abi.c | 2 +- arm64/isel.c | 2 +- copy.c | 4 ++-- fold.c | 4 ++-- mem.c | 2 +- parse.c | 6 +++--- rega.c | 2 +- spill.c | 2 +- ssa.c | 12 ++++++------ 11 files changed, 21 insertions(+), 21 deletions(-) diff --git a/amd64/isel.c b/amd64/isel.c index 46ed259..cb409c4 100644 --- a/amd64/isel.c +++ b/amd64/isel.c @@ -458,7 +458,7 @@ anumber(ANum *ai, Blk *b, Con *con) int a, a1, a2, n1, n2, t1, t2; Ins *i; - for (i=b->ins; i-b->ins < b->nins; i++) { + for (i=b->ins; i<&b->ins[b->nins]; i++) { if (rtype(i->to) == RTmp) ai[i->to.val].i = i; if (i->op != Oadd && i->op != Omul) @@ -574,7 +574,7 @@ amd64_isel(Fn *fn) b = fn->start; /* specific to NAlign == 3 */ /* or change n=4 and sz /= 4 below */ for (al=Oalloc, n=4; al<=Oalloc1; al++, n*=2) - for (i=b->ins; i-b->ins < b->nins; i++) + for (i=b->ins; i<&b->ins[b->nins]; i++) if (i->op == al) { if (rtype(i->arg[0]) != RCon) break; diff --git a/amd64/sysv.c b/amd64/sysv.c index 014452a..d70e70d 100644 --- a/amd64/sysv.c +++ b/amd64/sysv.c @@ -642,7 +642,7 @@ amd64_sysv_abi(Fn *fn) b->visit = 0; /* lower parameters */ - for (b=fn->start, i=b->ins; i-b->insnins; i++) + for (b=fn->start, i=b->ins; i<&b->ins[b->nins]; i++) if (!ispar(i->op)) break; fa = selpar(fn, b->ins, i); diff --git a/arm64/abi.c b/arm64/abi.c index b340af2..17ea1d1 100644 --- a/arm64/abi.c +++ b/arm64/abi.c @@ -645,7 +645,7 @@ arm64_abi(Fn *fn) b->visit = 0; /* lower parameters */ - for (b=fn->start, i=b->ins; i-b->insnins; i++) + for (b=fn->start, i=b->ins; i<&b->ins[b->nins]; i++) if (!ispar(i->op)) break; p = selpar(fn, b->ins, i); diff --git a/arm64/isel.c b/arm64/isel.c index 59f1579..031ba11 100644 --- a/arm64/isel.c +++ b/arm64/isel.c @@ -232,7 +232,7 @@ arm64_isel(Fn *fn) b = fn->start; /* specific to NAlign == 3 */ /* or change n=4 and sz /= 4 below */ for (al=Oalloc, n=4; al<=Oalloc1; al++, n*=2) - for (i=b->ins; i-b->ins < b->nins; i++) + for (i=b->ins; i<&b->ins[b->nins]; i++) if (i->op == al) { if (rtype(i->arg[0]) != RCon) break; diff --git a/copy.c b/copy.c index 55c31b2..4432986 100644 --- a/copy.c +++ b/copy.c @@ -121,7 +121,7 @@ copy(Fn *fn) for (b=fn->start; b; b=b->link) { for (p=b->phi; p; p=p->link) visitphi(p, cp, &pw); - for (i=b->ins; i-b->ins < b->nins; i++) + for (i=b->ins; i<&b->ins[b->nins]; i++) visitins(i, cp, &pw, fn); } while ((w1=w)) { @@ -155,7 +155,7 @@ copy(Fn *fn) subst(&p->arg[a], cp); pp=&p->link; } - for (i=b->ins; i-b->ins < b->nins; i++) { + for (i=b->ins; i<&b->ins[b->nins]; i++) { r = copyof(i->to, cp); if (!req(r, i->to)) { *i = (Ins){.op = Onop}; diff --git a/fold.c b/fold.c index c2375df..8fc64c5 100644 --- a/fold.c +++ b/fold.c @@ -221,7 +221,7 @@ fold(Fn *fn) for (p=b->phi; p; p=p->link) visitphi(p, n, fn); if (b->visit == 0) { - for (i=b->ins; i-b->ins < b->nins; i++) + for (i=b->ins; i<&b->ins[b->nins]; i++) visitins(i, fn); visitjmp(b, n, fn); } @@ -289,7 +289,7 @@ fold(Fn *fn) renref(&p->arg[a]); pp = &p->link; } - for (i=b->ins; i-b->ins < b->nins; i++) + for (i=b->ins; i<&b->ins[b->nins]; i++) if (renref(&i->to)) *i = (Ins){.op = Onop}; else diff --git a/mem.c b/mem.c index eda3d18..159b6bc 100644 --- a/mem.c +++ b/mem.c @@ -12,7 +12,7 @@ memopt(Fn *fn) /* promote uniform stack slots to temporaries */ b = fn->start; - for (i=b->ins; i-b->ins < b->nins; i++) { + for (i=b->ins; i<&b->ins[b->nins]; i++) { if (Oalloc > i->op || i->op > Oalloc1) continue; /* specific to NAlign == 3 */ diff --git a/parse.c b/parse.c index d9aa1b1..592e079 100644 --- a/parse.c +++ b/parse.c @@ -691,7 +691,7 @@ typecheck(Fn *fn) for (b=fn->start; b; b=b->link) { for (p=b->phi; p; p=p->link) fn->tmp[p->to.val].cls = p->cls; - for (i=b->ins; i-b->ins < b->nins; i++) + for (i=b->ins; i<&b->ins[b->nins]; i++) if (rtype(i->to) == RTmp) { t = &fn->tmp[i->to.val]; if (clsmerge(&t->cls, i->cls)) @@ -719,7 +719,7 @@ typecheck(Fn *fn) if (!bsequal(pb, ppb)) err("predecessors not matched in phi %%%s", t->name); } - for (i=b->ins; i-b->ins < b->nins; i++) + for (i=b->ins; i<&b->ins[b->nins]; i++) for (n=0; n<2; n++) { k = optab[i->op].argcls[n][i->cls]; r = i->arg[n]; @@ -1180,7 +1180,7 @@ printfn(Fn *fn, FILE *f) fprintf(f, ", "); } } - for (i=b->ins; i-b->ins < b->nins; i++) { + for (i=b->ins; i<&b->ins[b->nins]; i++) { fprintf(f, "\t"); if (!req(i->to, R)) { printref(i->to, fn, f); diff --git a/rega.c b/rega.c index 2f01c07..619b0e2 100644 --- a/rega.c +++ b/rega.c @@ -506,7 +506,7 @@ rega(Fn *fn) for (bp=blk, b=fn->start; b; b=b->link) *bp++ = b; qsort(blk, fn->nblk, sizeof blk[0], carve); - for (b=fn->start, i=b->ins; i-b->ins < b->nins; i++) + for (b=fn->start, i=b->ins; i<&b->ins[b->nins]; i++) if (i->op != Ocopy || !isreg(i->arg[0])) break; else { diff --git a/spill.c b/spill.c index d3a11f7..77496f6 100644 --- a/spill.c +++ b/spill.c @@ -77,7 +77,7 @@ fillcost(Fn *fn) } } n = b->loop; - for (i=b->ins; i-b->ins < b->nins; i++) { + for (i=b->ins; i<&b->ins[b->nins]; i++) { tmpuse(i->to, 0, n, fn); tmpuse(i->arg[0], 1, n, fn); tmpuse(i->arg[1], 1, n, fn); diff --git a/ssa.c b/ssa.c index 9aff73c..f7dabb8 100644 --- a/ssa.c +++ b/ssa.c @@ -71,7 +71,7 @@ filluse(Fn *fn) tmp[t].phi = tp; } } - for (i=b->ins; i-b->ins < b->nins; i++) { + for (i=b->ins; i<&b->ins[b->nins]; i++) { if (!req(i->to, R)) { assert(rtype(i->to) == RTmp); w = WFull; @@ -131,7 +131,7 @@ phiins(Fn *fn) for (b=fn->start; b; b=b->link) { b->visit = 0; r = R; - for (i=b->ins; i-b->ins < b->nins; i++) { + for (i=b->ins; i<&b->ins[b->nins]; i++) { if (!req(r, R)) { if (req(i->arg[0], TMP(t))) i->arg[0] = r; @@ -263,7 +263,7 @@ renblk(Blk *b, Name **stk, Fn *fn) for (p=b->phi; p; p=p->link) rendef(&p->to, b, stk, fn); - for (i=b->ins; i-b->ins < b->nins; i++) { + for (i=b->ins; i<&b->ins[b->nins]; i++) { for (m=0; m<2; m++) { t = i->arg[m].val; if (rtype(i->arg[m]) == RTmp) @@ -374,7 +374,7 @@ ssacheck(Fn *fn) for (p=b->phi; p; p=p->link) { r = p->to; t = &fn->tmp[r.val]; - for (u=t->use; u-t->use < t->nuse; u++) { + for (u=t->use; u<&t->use[t->nuse]; u++) { bu = fn->rpo[u->bid]; if (u->type == UPhi) { if (phicheck(u->u.phi, b, r)) @@ -384,12 +384,12 @@ ssacheck(Fn *fn) goto Err; } } - for (i=b->ins; i-b->ins < b->nins; i++) { + for (i=b->ins; i<&b->ins[b->nins]; i++) { if (rtype(i->to) != RTmp) continue; r = i->to; t = &fn->tmp[r.val]; - for (u=t->use; u-t->use < t->nuse; u++) { + for (u=t->use; u<&t->use[t->nuse]; u++) { bu = fn->rpo[u->bid]; if (u->type == UPhi) { if (phicheck(u->u.phi, b, r)) -- cgit 1.4.1