diff -ru a/src/runtime/hashmap_fast.go b/src/runtime/hashmap_fast.go --- a/src/runtime/hashmap_fast.go 2018-04-30 13:26:49.000000000 -0700 +++ b/src/runtime/hashmap_fast.go 2018-07-30 15:40:09.478159224 -0700 @@ -361,7 +361,7 @@ hash := t.key.alg.hash(noescape(unsafe.Pointer(&key)), uintptr(h.hash0)) // Set hashWriting after calling alg.hash for consistency with mapassign. - h.flags |= hashWriting + h.flags = h.flags ^ hashWriting if h.buckets == nil { h.buckets = newobject(t.bucket) // newarray(t.bucket, 1) @@ -447,7 +447,7 @@ hash := t.key.alg.hash(noescape(unsafe.Pointer(&key)), uintptr(h.hash0)) // Set hashWriting after calling alg.hash for consistency with mapassign. - h.flags |= hashWriting + h.flags = h.flags ^ hashWriting if h.buckets == nil { h.buckets = newobject(t.bucket) // newarray(t.bucket, 1) @@ -533,7 +533,7 @@ hash := t.key.alg.hash(noescape(unsafe.Pointer(&key)), uintptr(h.hash0)) // Set hashWriting after calling alg.hash for consistency with mapassign. - h.flags |= hashWriting + h.flags = h.flags ^ hashWriting if h.buckets == nil { h.buckets = newobject(t.bucket) // newarray(t.bucket, 1) @@ -619,7 +619,7 @@ hash := t.key.alg.hash(noescape(unsafe.Pointer(&key)), uintptr(h.hash0)) // Set hashWriting after calling alg.hash for consistency with mapassign. - h.flags |= hashWriting + h.flags = h.flags ^ hashWriting if h.buckets == nil { h.buckets = newobject(t.bucket) // newarray(t.bucket, 1) @@ -706,7 +706,7 @@ hash := t.key.alg.hash(noescape(unsafe.Pointer(&s)), uintptr(h.hash0)) // Set hashWriting after calling alg.hash for consistency with mapassign. - h.flags |= hashWriting + h.flags = h.flags ^ hashWriting if h.buckets == nil { h.buckets = newobject(t.bucket) // newarray(t.bucket, 1) @@ -797,7 +797,7 @@ hash := t.key.alg.hash(noescape(unsafe.Pointer(&key)), uintptr(h.hash0)) // Set hashWriting after calling alg.hash for consistency with mapdelete - h.flags |= hashWriting + h.flags = h.flags ^ hashWriting bucket := hash & bucketMask(h.B) if h.growing() { @@ -846,7 +846,7 @@ hash := t.key.alg.hash(noescape(unsafe.Pointer(&key)), uintptr(h.hash0)) // Set hashWriting after calling alg.hash for consistency with mapdelete - h.flags |= hashWriting + h.flags = h.flags ^ hashWriting bucket := hash & bucketMask(h.B) if h.growing() { @@ -896,7 +896,7 @@ hash := t.key.alg.hash(noescape(unsafe.Pointer(&ky)), uintptr(h.hash0)) // Set hashWriting after calling alg.hash for consistency with mapdelete - h.flags |= hashWriting + h.flags = h.flags ^ hashWriting bucket := hash & bucketMask(h.B) if h.growing() { diff -ru a/src/runtime/hashmap.go b/src/runtime/hashmap.go --- a/src/runtime/hashmap.go 2018-04-30 13:26:49.000000000 -0700 +++ b/src/runtime/hashmap.go 2018-07-30 13:14:06.137691211 -0700 @@ -523,7 +523,7 @@ // Set hashWriting after calling alg.hash, since alg.hash may panic, // in which case we have not actually done a write. - h.flags |= hashWriting + h.flags = h.flags ^ hashWriting if h.buckets == nil { h.buckets = newobject(t.bucket) // newarray(t.bucket, 1) @@ -635,7 +635,7 @@ // Set hashWriting after calling alg.hash, since alg.hash may panic, // in which case we have not actually done a write (delete). - h.flags |= hashWriting + h.flags = h.flags ^ hashWriting bucket := hash & bucketMask(h.B) if h.growing() {