X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fruntime%2Fgcinfo_test.go;h=5f72caf0ecebfbed9c98ca02e4241ca2ac119262;hb=38ac7c41aa54306c0bdc04a092838103a7d09997;hp=787160dc2779c8583240e35f0fcc60b172842da8;hpb=25867485a748bbefc938e66330912cd88c2f4acb;p=gostls13.git diff --git a/src/runtime/gcinfo_test.go b/src/runtime/gcinfo_test.go index 787160dc27..5f72caf0ec 100644 --- a/src/runtime/gcinfo_test.go +++ b/src/runtime/gcinfo_test.go @@ -91,10 +91,17 @@ func TestGCInfo(t *testing.T) { func verifyGCInfo(t *testing.T, name string, p any, mask0 []byte) { mask := runtime.GCMask(p) - if !bytes.Equal(mask, mask0) { - t.Errorf("bad GC program for %v:\nwant %+v\ngot %+v", name, mask0, mask) + if bytes.HasPrefix(mask, mask0) { + // Just the prefix matching is OK. + // + // The Go runtime's pointer/scalar iterator generates pointers beyond + // the size of the type, up to the size of the size class. This space + // is safe for the GC to scan since it's zero, and GCBits checks to + // make sure that's true. But we need to handle the fact that the bitmap + // may be larger than we expect. return } + t.Errorf("bad GC program for %v:\nwant %+v\ngot %+v", name, mask0, mask) } func trimDead(mask []byte) []byte {