mirror of
https://github.com/golang/go
synced 2024-11-26 14:46:47 -07:00
cmd/gc: don't require that slice index constants be small ints
The test for this is test/index.go, which is not run by default. R=remyoudompheng, rsc CC=golang-dev https://golang.org/cl/6812089
This commit is contained in:
parent
72bf3bc176
commit
2355409988
@ -2477,14 +2477,14 @@ sliceany(Node* n, NodeList **init)
|
|||||||
|
|
||||||
if(isconst(hb, CTINT)) {
|
if(isconst(hb, CTINT)) {
|
||||||
hbv = mpgetfix(hb->val.u.xval);
|
hbv = mpgetfix(hb->val.u.xval);
|
||||||
if(hbv < 0 || hbv > bv || !smallintconst(hb)) {
|
if(hbv < 0 || hbv > bv) {
|
||||||
yyerror("slice index out of bounds");
|
yyerror("slice index out of bounds");
|
||||||
hbv = -1;
|
hbv = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(isconst(lb, CTINT)) {
|
if(isconst(lb, CTINT)) {
|
||||||
lbv = mpgetfix(lb->val.u.xval);
|
lbv = mpgetfix(lb->val.u.xval);
|
||||||
if(lbv < 0 || lbv > bv || !smallintconst(lb)) {
|
if(lbv < 0 || lbv > bv) {
|
||||||
yyerror("slice index out of bounds");
|
yyerror("slice index out of bounds");
|
||||||
lbv = -1;
|
lbv = -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user