diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-09-20 22:06:20 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-09-20 22:06:20 +0000 |
commit | 6fa297991193239a6f167b92a3c4fc3e78ff400a (patch) | |
tree | 0424d8c034746d7c3964719c36411377a3a8166e | |
parent | 6675c41604f61f041d894413b2daabe177fa57a9 (diff) | |
download | gcc-6fa297991193239a6f167b92a3c4fc3e78ff400a.zip gcc-6fa297991193239a6f167b92a3c4fc3e78ff400a.tar.gz gcc-6fa297991193239a6f167b92a3c4fc3e78ff400a.tar.bz2 |
Fix calling make with slice whose element type is size zero.
From-SVN: r179019
-rw-r--r-- | libgo/runtime/go-make-slice.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libgo/runtime/go-make-slice.c b/libgo/runtime/go-make-slice.c index cd2d55b..d0e8369 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; |