@@ -279,7 +279,7 @@ func visitInstr(fr *frame, instr ssa.Instruction) continuation {
279
279
}()
280
280
281
281
case * ssa.MakeChan :
282
- fr .env [instr ] = make (chan value , asInt (fr .get (instr .Size )))
282
+ fr .env [instr ] = make (chan value , asInt64 (fr .get (instr .Size )))
283
283
284
284
case * ssa.Alloc :
285
285
var addr * value
@@ -294,17 +294,20 @@ func visitInstr(fr *frame, instr ssa.Instruction) continuation {
294
294
* addr = zero (deref (instr .Type ()))
295
295
296
296
case * ssa.MakeSlice :
297
- slice := make ([]value , asInt (fr .get (instr .Cap )))
297
+ slice := make ([]value , asInt64 (fr .get (instr .Cap )))
298
298
tElt := instr .Type ().Underlying ().(* types.Slice ).Elem ()
299
299
for i := range slice {
300
300
slice [i ] = zero (tElt )
301
301
}
302
- fr .env [instr ] = slice [:asInt (fr .get (instr .Len ))]
302
+ fr .env [instr ] = slice [:asInt64 (fr .get (instr .Len ))]
303
303
304
304
case * ssa.MakeMap :
305
- reserve := 0
305
+ var reserve int64
306
306
if instr .Reserve != nil {
307
- reserve = asInt (fr .get (instr .Reserve ))
307
+ reserve = asInt64 (fr .get (instr .Reserve ))
308
+ }
309
+ if ! fitsInt (reserve , fr .i .sizes ) {
310
+ panic (fmt .Sprintf ("ssa.MakeMap.Reserve value %d does not fit in int" , reserve ))
308
311
}
309
312
fr .env [instr ] = makeMap (instr .Type ().Underlying ().(* types.Map ).Key (), reserve )
310
313
@@ -325,15 +328,15 @@ func visitInstr(fr *frame, instr ssa.Instruction) continuation {
325
328
idx := fr .get (instr .Index )
326
329
switch x := x .(type ) {
327
330
case []value :
328
- fr .env [instr ] = & x [asInt (idx )]
331
+ fr .env [instr ] = & x [asInt64 (idx )]
329
332
case * value : // *array
330
- fr .env [instr ] = & (* x ).(array )[asInt (idx )]
333
+ fr .env [instr ] = & (* x ).(array )[asInt64 (idx )]
331
334
default :
332
335
panic (fmt .Sprintf ("unexpected x type in IndexAddr: %T" , x ))
333
336
}
334
337
335
338
case * ssa.Index :
336
- fr .env [instr ] = fr .get (instr .X ).(array )[asInt (fr .get (instr .Index ))]
339
+ fr .env [instr ] = fr .get (instr .X ).(array )[asInt64 (fr .get (instr .Index ))]
337
340
338
341
case * ssa.Lookup :
339
342
fr .env [instr ] = lookup (instr , fr .get (instr .X ), fr .get (instr .Index ))
0 commit comments