This libgo patch fixes the identity hash function for big-endian 32-bit systems. Before this patch the hash code for a 32-bit value always turned out to be zero on a big-endian 32-bit system. This patch fixes the problem. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline.
Ian
diff -r fcaf380a2380 libgo/runtime/go-type-identity.c --- a/libgo/runtime/go-type-identity.c Mon Feb 13 16:31:57 2012 -0800 +++ b/libgo/runtime/go-type-identity.c Tue Feb 14 09:59:20 2012 -0800 @@ -32,7 +32,10 @@ } u; u.v = 0; __builtin_memcpy (&u.a, key, key_size); - return (uintptr_t) u.v; + if (sizeof (uintptr_t) >= 8) + return (uintptr_t) u.v; + else + return (uintptr_t) ((u.v >> 32) ^ (u.v & 0xffffffff)); } ret = 5381;