diff --git a/libgo/runtime/go-make-slice.c b/libgo/runtime/go-make-slice.c index cd2d55bd538..d0e8369c1f6 100644 --- a/libgo/runtime/go-make-slice.c +++ b/libgo/runtime/go-make-slice.c @@ -35,7 +35,8 @@ __go_make_slice2 (const struct __go_type_descriptor *td, uintptr_t len, icap = (int) cap; if (cap < len || (uintptr_t) icap != cap - || cap > (uintptr_t) -1U / std->__element_type->__size) + || (std->__element_type->__size > 0 + && cap > (uintptr_t) -1U / std->__element_type->__size)) __go_panic_msg ("makeslice: cap out of range"); ret.__count = ilen;