summaryrefslogtreecommitdiff
path: root/src/cmd/gc/walk.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-05-01 13:15:42 -0700
committerRuss Cox <rsc@golang.org>2010-05-01 13:15:42 -0700
commit7f880650f76417b4010da786f4c82009a987d4ab (patch)
tree2ff37f89bce27884dc59c851f1d2e97977ef487d /src/cmd/gc/walk.c
parent93076f9a25e6470ea07d6459abd122c60398a1ec (diff)
downloadgolang-7f880650f76417b4010da786f4c82009a987d4ab.tar.gz
gc: be pickier about slice, chan, array, and map sizes
Fixes issue 589. R=ken2 CC=golang-dev http://codereview.appspot.com/1032044
Diffstat (limited to 'src/cmd/gc/walk.c')
-rw-r--r--src/cmd/gc/walk.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/cmd/gc/walk.c b/src/cmd/gc/walk.c
index 951496e60..a79c75131 100644
--- a/src/cmd/gc/walk.c
+++ b/src/cmd/gc/walk.c
@@ -1138,7 +1138,7 @@ walkexpr(Node **np, NodeList **init)
case OMAKECHAN:
n = mkcall1(chanfn("makechan", 1, n->type), n->type, init,
typename(n->type->type),
- conv(n->left, types[TINT]));
+ conv(n->left, types[TINT64]));
goto ret;
case OMAKEMAP:
@@ -1151,18 +1151,22 @@ walkexpr(Node **np, NodeList **init)
n = mkcall1(fn, n->type, init,
typename(t->down), // key type
typename(t->type), // value type
- conv(n->left, types[TINT]));
+ conv(n->left, types[TINT64]));
goto ret;
case OMAKESLICE:
- // makeslice(nel int, max int, width int) (ary []any)
+ // makeslice(t *Type, nel int64, max int64) (ary []any)
+ l = n->left;
+ r = n->right;
+ if(r == nil)
+ l = r = safeexpr(l, init);
t = n->type;
fn = syslook("makeslice", 1);
argtype(fn, t->type); // any-1
n = mkcall1(fn, n->type, init,
typename(n->type),
- conv(n->left, types[TINT]),
- conv(n->right, types[TINT]));
+ conv(l, types[TINT64]),
+ conv(r, types[TINT64]));
goto ret;
case ORUNESTR: