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: a9407b breaks address offset calculation #15042

Closed
kortschak opened this issue Mar 31, 2016 · 3 comments
Closed

cmd/compile: a9407b breaks address offset calculation #15042

kortschak opened this issue Mar 31, 2016 · 3 comments
Milestone

Comments

@kortschak
Copy link
Contributor

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
    go version devel +93098de
  2. What operating system and processor architecture are you using (go env)?
    GOARCH="amd64"
    GOOS="linux"
  3. What did you do?
    If possible, provide a recipe for reproducing the error.
    A complete runnable program is good.
    A link on play.golang.org is best.
go get -u github.com/gonum/matrix/mat64
go test -a -run DenseOverlaps github.com/gonum/matrix/mat64 # unsafe dependency
go test -a -tags appengine -run DenseOverlaps github.com/gonum/matrix/mat64 # no unsafe dependency
  1. What did you expect to see?

Both test invocations pass. This is the behaviour with go1.6

  1. What did you see instead?

Both invocations fail.

The change in behaviour was bisected to a9407b5.

The now failing code calculates relative address offsets between two []float64 elements (either with unsafe or reflect) to identify matrix overlaps.

@josharian
Copy link
Contributor

@ianlancetaylor

@ianlancetaylor
Copy link
Contributor

Simple test case. This program does not panic with Go 1.5 or Go 1.6, does panic with tip.

package main

type S struct {
    i int
}

func F(c bool, s1, s2 S) (int, int) {
    if c {
        s1.i, s2.i = s2.i, s1.i
    }
    return s1.i, s2.i
}

func main() {
    i, j := F(true, S{1}, S{20})
    if i != 20 || j != 1 {
        panic(i+j)
    }
}

@gopherbot
Copy link

CL https://golang.org/cl/21390 mentions this issue.

@golang golang locked and limited conversation to collaborators Apr 1, 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

6 participants