]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/gc: don't require that slice index constants be small ints
authorIan Lance Taylor <iant@golang.org>
Tue, 6 Nov 2012 19:36:59 +0000 (11:36 -0800)
committerIan Lance Taylor <iant@golang.org>
Tue, 6 Nov 2012 19:36:59 +0000 (11:36 -0800)
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

src/cmd/gc/walk.c

index 11c9c2f4352d907be5aed89efd6d23900aaba94f..2c1a32eaefd06c3f1c0fd8827c67ef5c030e54ab 100644 (file)
@@ -2477,14 +2477,14 @@ sliceany(Node* n, NodeList **init)
 
        if(isconst(hb, CTINT)) {
                hbv = mpgetfix(hb->val.u.xval);
-               if(hbv < 0 || hbv > bv || !smallintconst(hb)) {
+               if(hbv < 0 || hbv > bv) {
                        yyerror("slice index out of bounds");
                        hbv = -1;
                }
        }
        if(isconst(lb, CTINT)) {
                lbv = mpgetfix(lb->val.u.xval);
-               if(lbv < 0 || lbv > bv || !smallintconst(lb)) {
+               if(lbv < 0 || lbv > bv) {
                        yyerror("slice index out of bounds");
                        lbv = -1;
                }