summaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2011-09-20 22:06:20 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2011-09-20 22:06:20 +0000
commit20956cf33154355c7c2813c76a883216d7f34d2e (patch)
tree0424d8c034746d7c3964719c36411377a3a8166e /libgo
parent537d474e4feb7f52f97d848f68724553684bf69e (diff)
downloadgcc-20956cf33154355c7c2813c76a883216d7f34d2e.tar.gz
Fix calling make with slice whose element type is size zero.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@179019 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo')
-rw-r--r--libgo/runtime/go-make-slice.c3
1 files changed, 2 insertions, 1 deletions
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;