]> Cypherpunks repositories - gostls13.git/commitdiff
8g: call throwindex for array out of bounds
authorRuss Cox <rsc@golang.org>
Mon, 23 Nov 2009 20:58:28 +0000 (12:58 -0800)
committerRuss Cox <rsc@golang.org>
Mon, 23 Nov 2009 20:58:28 +0000 (12:58 -0800)
R=ken2
https://golang.org/cl/160043

src/cmd/8g/cgen.c

index b6b855de8bb7764ef9387733d565d81d03943374..cc93cf3e50cd59493ac475b8fb65d2e2c167a37f 100644 (file)
@@ -548,8 +548,7 @@ agen(Node *n, Node *res)
                                        nodconst(&n2, types[TUINT32], v);
                                        gins(optoas(OCMP, types[TUINT32]), &n1, &n2);
                                        p1 = gbranch(optoas(OGT, types[TUINT32]), T);
-                                       //ginscall(throwindex, 0);
-                                       gins(AINT, nodintconst(3), N);
+                                       ginscall(throwindex, 0);
                                        patch(p1, pc);
                                }
 
@@ -595,8 +594,7 @@ agen(Node *n, Node *res)
                                nodconst(&n1, types[TUINT32], nl->type->bound);
                        gins(optoas(OCMP, types[TUINT32]), &n2, &n1);
                        p1 = gbranch(optoas(OLT, types[TUINT32]), T);
-                       //ginscall(throwindex, 0);
-                       gins(AINT, nodintconst(3), N);
+                       ginscall(throwindex, 0);
                        patch(p1, pc);
                }