diff --git a/src/runtime/mbarrier.go b/src/runtime/mbarrier.go index c071728900..c446db93d2 100644 --- a/src/runtime/mbarrier.go +++ b/src/runtime/mbarrier.go @@ -254,6 +254,10 @@ func typedslicecopy(typ *_type, dst, src slice) int { cgoCheckSliceCopy(typ, dst, src, n) } + if dstp == srcp { + return n + } + // Note: No point in checking typ.kind&kindNoPointers here: // compiler only emits calls to typedslicecopy for types with pointers, // and growslice and reflect_typedslicecopy check for pointers