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?
to your account
This worked correctly in go1.16 but doesn't in 1.17 or on tip at:
go version devel go1.18-051df0d722 Wed Sep 22 03:45:00 2021 +0000 linux/amd64
When compiling https://play.golang.org/p/zUNR4CgABnt with -gcflags=-N -l the inner loop is compiled to:
test.go:38 | S | 0x47faec | MOVQ 0x48(SP), AX
test.go:38 | | 0x47faf1 | CALL main.intToInterval(SB)
test.go:38 | | 0x47faf6 | MOVQ AX, 0x60(SP)
test.go:38 | | 0x47fafb | JMP 0x47faff
test.go:40 | | 0x47fafd | JMP 0x47faff
test.go:40 | S | 0x47faff | CMPQ $0x0, 0x60(SP)
test.go:40 | | 0x47fb05 | JNE 0x47fb0c
test.go:40 | | 0x47fb07 | JMP 0x47fba4
test.go:35 | S | 0x47fb0c | MOVQ 0x60(SP), CX
test.go:41 | S | 0x47fb11 | MOVQ 0x58(SP), BX
test.go:41 | | 0x47fb16 | LEAQ type..eq.main.interval+39776(SB), AX
test.go:41 | | 0x47fb1d | NOPL 0(AX)
test.go:41 | S | 0x47fb20 | CALL runtime.mapassign_fast64ptr(SB)
I believe the instruction at 0x47fb0c is simply loading interval into an argfument of runtime.mapassign_fast64ptr, however it gets assigned to line 35 which is the declaration of interval, outside of the loop.
The text was updated successfully, but these errors were encountered:
No branches or pull requests