diff mbox

Go patch committed: Fix channels with element types of size zero

Message ID mcrboueaf2a.fsf@coign.corp.google.com
State New
Headers show

Commit Message

Ian Lance Taylor Sept. 21, 2011, 12:56 a.m. UTC
This trivial patch to the Go library fixes using channels with element
types of size zero.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian
diff mbox

Patch

diff -r f87ff36963ee libgo/runtime/go-new-channel.c
--- a/libgo/runtime/go-new-channel.c	Tue Sep 20 17:10:50 2011 -0700
+++ b/libgo/runtime/go-new-channel.c	Tue Sep 20 17:11:39 2011 -0700
@@ -33,7 +33,7 @@ 
   ientries = (int) entries;
   if (ientries < 0
       || (uintptr_t) ientries != entries
-      || entries > (uintptr_t) -1 / element_size)
+      || (element_size > 0 && entries > (uintptr_t) -1 / element_size))
     __go_panic_msg ("chan size out of range");
 
   alloc_size = (element_size + sizeof (uint64_t) - 1) / sizeof (uint64_t);