Skip to content

fatal error on -race with array #408

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jonasi opened this issue Nov 7, 2022 · 0 comments · Fixed by #415
Closed

fatal error on -race with array #408

jonasi opened this issue Nov 7, 2022 · 0 comments · Fixed by #415

Comments

@jonasi
Copy link

jonasi commented Nov 7, 2022

Here's a minimal repro with steps on go1.18.

/tmp/test/main.go

package main

import (
	"github.com/goccy/go-json"
)

func main() {
	var x X
	json.Unmarshal([]byte(`{"arr": [1,2]}`), &x)
}

type X struct {
	Arr [2]int32 `json:"arr"`
}

error:

fatal error: checkptr: misaligned pointer conversion

goroutine 1 [running]:
runtime.throw({0x102b324fd?, 0x102a8f6f8?})
        /Users/isao/.gimme/versions/go1.18.darwin.arm64/src/runtime/panic.go:992 +0x50 fp=0xc0000a11f0 sp=0xc0000a11c0 pc=0x1029de570
runtime.checkptrAlignment(0xc0000a1238?, 0x102a2bc7c?, 0xc0000a1238?)
        /Users/isao/.gimme/versions/go1.18.darwin.arm64/src/runtime/checkptr.go:20 +0x90 fp=0xc0000a1210 sp=0xc0000a11f0 pc=0x1029b43b0
github.com/goccy/go-json/internal/decoder.newArrayDecoder({0x102bf1638?, 0xc0000e2080}, 0x102bcef40, 0x2, {0x102bc518c, 0x1}, {0x102bc7792, 0x3})
        /Users/isao/go/pkg/mod/github.com/goccy/[email protected]/internal/decoder/array.go:21 +0x64 fp=0xc0000a1280 sp=0xc0000a1210 pc=0x102a8f714
github.com/goccy/go-json/internal/decoder.compileArray(0x102bcff60?, {0x102bc518c, 0x1}, {0x102bc7792, 0x3}, 0x102a95798?)
        /Users/isao/go/pkg/mod/github.com/goccy/[email protected]/internal/decoder/compile.go:290 +0xe4 fp=0xc0000a1320 sp=0xc0000a1280 pc=0x102a94b14
github.com/goccy/go-json/internal/decoder.compile(0x102bcff60, {0x102bc518c, 0x1}, {0x102bc7792, 0x3}, 0x102bcff60?)
        /Users/isao/go/pkg/mod/github.com/goccy/[email protected]/internal/decoder/compile.go:90 +0x934 fp=0xc0000a1450 sp=0xc0000a1320 pc=0x102a92144
github.com/goccy/go-json/internal/decoder.compileStruct(0x102bd7060, {0x0, 0x0}, {0x0, 0x0}, 0xc0000e2000?)
        /Users/isao/go/pkg/mod/github.com/goccy/[email protected]/internal/decoder/compile.go:345 +0x5fc fp=0xc0000a1aa0 sp=0xc0000a1450 pc=0x102a957dc
github.com/goccy/go-json/internal/decoder.compile(0x102bd7060, {0x0, 0x0}, {0x0, 0x0}, 0x1029ef388?)
        /Users/isao/go/pkg/mod/github.com/goccy/[email protected]/internal/decoder/compile.go:82 +0xcac fp=0xc0000a1bd0 sp=0xc0000a1aa0 pc=0x102a924bc
github.com/goccy/go-json/internal/decoder.compileHead(0x102d07450?, 0x102cc22c0?)
        /Users/isao/go/pkg/mod/github.com/goccy/[email protected]/internal/decoder/compile.go:67 +0x284 fp=0xc0000a1c80 sp=0xc0000a1bd0 pc=0x102a917c4
github.com/goccy/go-json/internal/decoder.CompileToGetDecoder(0x102bcbcc0)
        /Users/isao/go/pkg/mod/github.com/goccy/[email protected]/internal/decoder/compile_race.go:29 +0x1a4 fp=0xc0000a1e40 sp=0xc0000a1c80 pc=0x102a972e4
github.com/goccy/go-json.unmarshal({0xc0000a1f52, 0xe, 0xc000090010?}, {0x102bcbcc0, 0xc0000bc1c8}, {0x0, 0x0, 0x0?})
        /Users/isao/go/pkg/mod/github.com/goccy/[email protected]/decode.go:37 +0xa4 fp=0xc0000a1f00 sp=0xc0000a1e40 pc=0x102b27974
github.com/goccy/go-json.Unmarshal(...)
        /Users/isao/go/pkg/mod/github.com/goccy/[email protected]/json.go:276
main.main()
        /tmp/test/main.go:9 +0x90 fp=0xc0000a1f70 sp=0xc0000a1f00 pc=0x102b28fa0
runtime.main()
        /Users/isao/.gimme/versions/go1.18.darwin.arm64/src/runtime/proc.go:250 +0x250 fp=0xc0000a1fd0 sp=0xc0000a1f70 pc=0x1029e0ab0
runtime.goexit()
        /Users/isao/.gimme/versions/go1.18.darwin.arm64/src/runtime/asm_arm64.s:1259 +0x4 fp=0xc0000a1fd0 sp=0xc0000a1fd0 pc=0x102a0b804
exit status 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant