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: missing BCE on slice in loop #15203

Closed
rasky opened this issue Apr 8, 2016 · 2 comments
Closed

cmd/compile: missing BCE on slice in loop #15203

rasky opened this issue Apr 8, 2016 · 2 comments

Comments

@rasky
Copy link
Member

rasky commented Apr 8, 2016

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
    go version devel +4dae828 Fri Apr 8 05:40:53 2016 +0000 darwin/amd64
  2. What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/rasky/Sources/go"
GORACE=""
GOROOT="/Users/rasky/Sources/gosrc"
GOTOOLDIR="/Users/rasky/Sources/gosrc/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/lw/jdbk7p_d4gj6qpydczpbw2080000gn/T/go-build978352921=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
  1. What did you do?
func Bound2(data []byte) uint32 {
    var sum uint32
    for i := 0; i < len(data); i += 4 {
        sum += binary.LittleEndian.Uint32(data[i:])
    }
    return sum
}
  1. What did you expect to see?
    In the generate code, there should be no calls to runtime.panicindex nor runtime.panicslice.
  2. What did you see instead?
TEXT main.Bound2(SB) /Users/rasky/Sources/go/src/ndsemu/bugs/bound1.go
    bound1.go:31    0x20a0  65488b0c25a0080000  GS MOVQ GS:0x8a0, CX
    bound1.go:31    0x20a9  483b6110        CMPQ 0x10(CX), SP
    bound1.go:31    0x20ad  766f            JBE 0x211e
    bound1.go:31    0x20af  4883ec08        SUBQ $0x8, SP
    bound1.go:33    0x20b3  31c0            XORL AX, AX
    bound1.go:33    0x20b5  488b4c2410      MOVQ 0x10(SP), CX
    bound1.go:33    0x20ba  488b542420      MOVQ 0x20(SP), DX
    bound1.go:33    0x20bf  488b5c2418      MOVQ 0x18(SP), BX
    bound1.go:31    0x20c4  31ed            XORL BP, BP
    bound1.go:33    0x20c6  48890424        MOVQ AX, 0(SP)
    bound1.go:33    0x20ca  4839d8          CMPQ BX, AX
    bound1.go:33    0x20cd  7d34            JGE 0x2103
    bound1.go:34    0x20cf  7746            JA 0x2117
    bound1.go:34    0x20d1  4889de          MOVQ BX, SI
    bound1.go:34    0x20d4  4829c6          SUBQ AX, SI
    bound1.go:34    0x20d7  4889d7          MOVQ DX, DI
    bound1.go:34    0x20da  4829c7          SUBQ AX, DI
    bound1.go:34    0x20dd  4885ff          TESTQ DI, DI
    bound1.go:34    0x20e0  7431            JE 0x2113
    bound1.go:34    0x20e2  4883fe03        CMPQ $0x3, SI
    bound1.go:34    0x20e6  7624            JBE 0x210c
    bound1.go:33    0x20e8  488b3424        MOVQ 0(SP), SI
    bound1.go:33    0x20ec  4883c604        ADDQ $0x4, SI
    bound1.go:34    0x20f0  8b0401          MOVL 0(CX)(AX*1), AX
    bound1.go:34    0x20f3  01e8            ADDL BP, AX
    bound1.go:34    0x20f5  89c5            MOVL AX, BP
    bound1.go:33    0x20f7  4889f0          MOVQ SI, AX
    bound1.go:33    0x20fa  48890424        MOVQ AX, 0(SP)
    bound1.go:33    0x20fe  4839d8          CMPQ BX, AX
    bound1.go:33    0x2101  7ccc            JL 0x20cf
    bound1.go:36    0x2103  896c2428        MOVL BP, 0x28(SP)
    bound1.go:36    0x2107  4883c408        ADDQ $0x8, SP
    bound1.go:36    0x210b  c3          RET
    bound1.go:34    0x210c  e8cfee0100      CALL runtime.panicindex(SB)
    bound1.go:34    0x2111  0f0b            UD2
    bound1.go:33    0x2113  31c0            XORL AX, AX
    bound1.go:34    0x2115  ebcb            JMP 0x20e2
    bound1.go:34    0x2117  e834ef0100      CALL runtime.panicslice(SB)
    bound1.go:34    0x211c  0f0b            UD2
    bound1.go:31    0x211e  e82d360400      CALL runtime.morestack_noctxt(SB)
    bound1.go:31    0x2123  e978ffffff      JMP main.Bound2(SB)
    bound1.go:31    0x2128  cc          INT $0x3
    bound1.go:31    0x2129  cc          INT $0x3
    bound1.go:31    0x212a  cc          INT $0x3
    bound1.go:31    0x212b  cc          INT $0x3
    bound1.go:31    0x212c  cc          INT $0x3
    bound1.go:31    0x212d  cc          INT $0x3
    bound1.go:31    0x212e  cc          INT $0x3
    bound1.go:31    0x212f  cc          INT $0x3
@rasky
Copy link
Member Author

rasky commented Apr 8, 2016

/cc @brtzsnr

@rasky
Copy link
Member Author

rasky commented Apr 8, 2016

Ops, sorry, I reduced too much and I'm missing a precondition. Let's ignore for now.

@rasky rasky closed this as completed Apr 8, 2016
@golang golang locked and limited conversation to collaborators Apr 9, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants