Commit 6ed2b6c4 authored by Shenghou Ma's avatar Shenghou Ma Committed by Russ Cox

5c, 6c, 8c, 6g, 8g: correct boundary checking

    CL 5666043 fixed the same checking for 5g.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5666045
parent 98896826
......@@ -357,7 +357,7 @@ regfree(Node *n)
if(n->op != OREGISTER && n->op != OINDREG)
goto err;
i = n->reg;
if(i < 0 || i >= sizeof(reg))
if(i < 0 || i >= nelem(reg))
goto err;
if(reg[i] <= 0)
goto err;
......
......@@ -411,7 +411,7 @@ regfree(Node *n)
if(n->op != OREGISTER && n->op != OINDREG)
goto err;
i = n->reg;
if(i < 0 || i >= sizeof(reg))
if(i < 0 || i >= nelem(reg))
goto err;
if(reg[i] <= 0)
goto err;
......
......@@ -419,7 +419,7 @@ regfree(Node *n)
i = n->val.u.reg;
if(i == D_SP)
return;
if(i < 0 || i >= sizeof(reg))
if(i < 0 || i >= nelem(reg))
fatal("regfree: reg out of range");
if(reg[i] <= 0)
fatal("regfree: reg not allocated");
......
......@@ -372,7 +372,7 @@ regfree(Node *n)
if(n->op != OREGISTER && n->op != OINDREG)
goto err;
i = n->reg;
if(i < 0 || i >= sizeof(reg))
if(i < 0 || i >= nelem(reg))
goto err;
if(reg[i] <= 0)
goto err;
......
......@@ -893,7 +893,7 @@ regfree(Node *n)
i = n->val.u.reg;
if(i == D_SP)
return;
if(i < 0 || i >= sizeof(reg))
if(i < 0 || i >= nelem(reg))
fatal("regfree: reg out of range");
if(reg[i] <= 0)
fatal("regfree: reg not allocated");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment