We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
func f(s []int) []int { return s[:0] }
compiles to
0x0000 00000 (slice0.go:4) MOVQ "".s+24(FP), CX 0x0005 00005 (slice0.go:4) CMPQ CX, $0 0x0009 00009 (slice0.go:4) JEQ $0, 11 0x000b 00011 (slice0.go:4) MOVQ "".s+8(FP), DX 0x0010 00016 (slice0.go:4) MOVQ DX, "".~r1+32(FP) 0x0015 00021 (slice0.go:4) MOVQ $0, "".~r1+40(FP) 0x001e 00030 (slice0.go:4) MOVQ CX, "".~r1+48(FP)
The comparison is unnecessary, [:0] is always legal. And the branch doesn't go anywhere.
Might be a dup of #14849
@brtzsnr
The text was updated successfully, but these errors were encountered:
Looks like a dup of #14849, but let me know if you find more of these cases. The generated code is now
v22 00074 (a.go:23) MOVQ "".s(FP), AX v10 00075 (a.go:23) MOVQ AX, "".~r1+24(FP) v13 00076 (a.go:23) MOVQ $0, "".~r1+32(FP) v21 00077 (a.go:23) MOVQ "".s+16(FP), AX v27 00078 (a.go:23) MOVQ AX, "".~r1+40(FP)
Sorry, something went wrong.
No branches or pull requests
compiles to
The comparison is unnecessary, [:0] is always legal. And the branch doesn't go anywhere.
Might be a dup of #14849
@brtzsnr
The text was updated successfully, but these errors were encountered: