Skip to content
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

cmd/compile: bad line number assigned to instruction loading value into argument register #48546

aarzilli opened this issue Sep 22, 2021 · 0 comments


Copy link

@aarzilli aarzilli commented Sep 22, 2021

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 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.

cc @dr2chase

@dr2chase dr2chase self-assigned this Sep 22, 2021
@dr2chase dr2chase added the NeedsFix label Sep 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants