Skip to content

retrieveUnexportedField violates Go 1.14's checkptr validation, fails under -race #167

Closed
knative/pkg
#1167

Description

With Go tip (to become Go 1.14) and its new checkptr mode (enabled by default in -race mode on anything but Windows for now):

=== CONT  TestDiff/EqualMethod/StructE1
panic: runtime error: unsafe pointer arithmetic [recovered]
        panic: runtime error: unsafe pointer arithmetic [recovered]
        panic: runtime error: unsafe pointer arithmetic

goroutine 142 [running]:
testing.tRunner.func1(0xc000238d00)
        /home/bradfitz/go/src/testing/testing.go:881 +0x69f
panic(0x6f3c00, 0xc00000f5e0)
        /home/bradfitz/go/src/runtime/panic.go:679 +0x1b2
github.com/google/go-cmp/cmp_test.TestDiff.func1.1.1(0xc000097eb8)
        /home/bradfitz/pkg/mod/github.com/google/go-cmp@v0.3.1/cmp/compare_test.go:70 +0xfe
panic(0x6f3c00, 0xc00000f5e0)
        /home/bradfitz/go/src/runtime/panic.go:679 +0x1b2
github.com/google/go-cmp/cmp.retrieveUnexportedField(0x6e33c0, 0xc000128ad8, 0x199, 0x6ad073, 0xd, 0x6b70c3, 0x31, 0x778440, 0x6d34e0, 0x0, ...)
        /home/bradfitz/pkg/mod/github.com/google/go-cmp@v0.3.1/cmp/export_unsafe.go:22 +0x7d
github.com/google/go-cmp/cmp.StructField.Values(0xc0002bd300, 0x8, 0x42c5e0, 0x0, 0x0, 0xc00026f6c0, 0x203000)
        /home/bradfitz/pkg/mod/github.com/google/go-cmp@v0.3.1/cmp/path.go:190 +0x187
github.com/google/go-cmp/cmp.(*valueNode).PushStep(0xc0000a8420, 0x775540, 0xc0002bd300, 0x45bc9a)
        /home/bradfitz/pkg/mod/github.com/google/go-cmp@v0.3.1/cmp/report_value.go:54 +0x5d
github.com/google/go-cmp/cmp.(*defaultReporter).PushStep(0xc00027d680, 0x775540, 0xc0002bd300)
        /home/bradfitz/pkg/mod/github.com/google/go-cmp@v0.3.1/cmp/report.go:24 +0x6e
github.com/google/go-cmp/cmp.(*state).compareAny(0xc0002be900, 0x775540, 0xc0002bd300)
        /home/bradfitz/pkg/mod/github.com/google/go-cmp@v0.3.1/cmp/compare.go:214 +0x22d
github.com/google/go-cmp/cmp.(*state).compareStruct(0xc0002be900, 0x778440, 0x6e33c0, 0x6e33c0, 0xc000128ad8, 0x199, 0x6e33c0, 0xc000128ae0, 0x199)
        /home/bradfitz/pkg/mod/github.com/google/go-cmp@v0.3.1/cmp/compare.go:383 +0x548
github.com/google/go-cmp/cmp.(*state).compareAny(0xc0002be900, 0x775480, 0xc000012a00)
        /home/bradfitz/pkg/mod/github.com/google/go-cmp@v0.3.1/cmp/compare.go:252 +0x1a58
github.com/google/go-cmp/cmp.(*state).comparePtr(0xc0002be900, 0x778440, 0x6d8140, 0x6d8140, 0xc000128ad8, 0x16, 0x6d8140, 0xc000128ae0, 0x16)
        /home/bradfitz/pkg/mod/github.com/google/go-cmp@v0.3.1/cmp/compare.go:513 +0x526
github.com/google/go-cmp/cmp.(*state).compareAny(0xc0002be900, 0x775280, 0xc0000129c0)
        /home/bradfitz/pkg/mod/github.com/google/go-cmp@v0.3.1/cmp/compare.go:258 +0x18e6
github.com/google/go-cmp/cmp.Equal(0x6d8140, 0xc000128ad8, 0x6d8140, 0xc000128ae0, 0xc00000f580, 0x2, 0x2, 0x580c98)
        /home/bradfitz/pkg/mod/github.com/google/go-cmp@v0.3.1/cmp/compare.go:107 +0x406
github.com/google/go-cmp/cmp.Diff(0x6d8140, 0xc000128ad8, 0x6d8140, 0xc000128ae0, 0xc00012ab70, 0x1, 0x1, 0xc000106000, 0xc000106070)
        /home/bradfitz/pkg/mod/github.com/google/go-cmp@v0.3.1/cmp/compare.go:127 +0x1ce
github.com/google/go-cmp/cmp_test.TestDiff.func1.1(0xc000241eb8, 0xc00023c600, 0xc0002f7ec8)
        /home/bradfitz/pkg/mod/github.com/google/go-cmp@v0.3.1/cmp/compare_test.go:74 +0x138
github.com/google/go-cmp/cmp_test.TestDiff.func1(0xc000238d00)
        /home/bradfitz/pkg/mod/github.com/google/go-cmp@v0.3.1/cmp/compare_test.go:75 +0x99
testing.tRunner(0xc000238d00, 0xc0001c1bd0)
        /home/bradfitz/go/src/testing/testing.go:916 +0x19a
created by testing.(*T).Run
        /home/bradfitz/go/src/testing/testing.go:967 +0x652
FAIL    github.com/google/go-cmp/cmp    0.116s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions