diff options
author | Austin Clements <austin@google.com> | 2014-10-30 11:17:26 -0400 |
---|---|---|
committer | Austin Clements <austin@google.com> | 2014-10-30 11:17:26 -0400 |
commit | d3be736b489539099e30ec2ae6c1f0054ca6fade (patch) | |
tree | 7c22dfbd18768be58e1cfe301dd82a4492368c8a | |
parent | 73a25e59b05a84458240f7c16bb04397cedd2e0c (diff) | |
download | go-d3be736b489539099e30ec2ae6c1f0054ca6fade.tar.gz |
[dev.power64] runtime: test CAS on large unsigned 32-bit numbers
This adds a test to runtime?check to ensure CAS of large
unsigned 32-bit numbers does not accidentally sign-extend its
arguments.
LGTM=rsc
R=rsc
CC=golang-codereviews
https://codereview.appspot.com/162490044
-rw-r--r-- | src/runtime/runtime.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/runtime/runtime.c b/src/runtime/runtime.c index f19f8e4be..a68414284 100644 --- a/src/runtime/runtime.c +++ b/src/runtime/runtime.c @@ -226,6 +226,12 @@ runtime·check(void) if(z != 4) runtime·throw("cas4"); + z = 0xffffffff; + if(!runtime·cas(&z, 0xffffffff, 0xfffffffe)) + runtime·throw("cas5"); + if(z != 0xfffffffe) + runtime·throw("cas6"); + k = (byte*)0xfedcb123; if(sizeof(void*) == 8) k = (byte*)((uintptr)k<<10); |