Patchwork [gccgo] Correct nonblocking receive of large value

login
register
mail settings
Submitter Ian Taylor
Date June 27, 2010, 12:09 a.m.
Message ID <mcrhbkp1gl0.fsf@google.com>
Download mbox | patch
Permalink /patch/57078/
State New
Headers show

Comments

Ian Taylor - June 27, 2010, 12:09 a.m.
I managed to write the code for a nonblocking receive of a large value
on a channel incorrectly.  Oddly, nothing noticed until I recently ran
the tests on a 64-bit system.  This patch fixes the problem.  Committed
to gccgo branch.

Ian

Patch

diff -r f58cfc636c53 libgo/runtime/go-rec-nb-big.c
--- a/libgo/runtime/go-rec-nb-big.c	Sat Jun 26 17:01:41 2010 -0700
+++ b/libgo/runtime/go-rec-nb-big.c	Sat Jun 26 17:07:26 2010 -0700
@@ -31,7 +31,7 @@ 
 	}
     }
 
-  offset = channel->next_store * alloc_size;
+  offset = channel->next_fetch * alloc_size;
   __builtin_memcpy (val, &channel->data[offset], channel->element_size);
 
   __go_receive_release (channel);