1. Ross Light
  2. gopdf
  3. Issues
Issue #14 new

Build failure on Windows 32 bits

Bruno Clermont
created an issue
$ GOOS=windows GOARCH=386 go build
# bitbucket.org/zombiezen/gopdf/pdf
run compiler with -v for register allocation sites
bitbucket.org/zombiezen/gopdf/pdf/image.go:89: internal compiler error: out of fixed registers

Tried with Go 1.6.0.

The code that fail is:

buf[j+0] = byte(uint16(img.Pix[i+0]) * 0xff / a)

Yeah, it look like a Go bug, but maybe something there is not easy for it to handle.

Here is a commit in stdlib that work around a similar bug:

https://github.com/golang/image/commit/c6de6b60d2af6dc769c7656b94ba848e34435d44

Comments (5)

  1. Bruno Clermont reporter
    func encodeRGBAStream(w io.Writer, img *image.RGBA) error {
        buf := make([]byte, 3*img.Rect.Dx()*img.Rect.Dy())
        var a uint16
        for i, j := 0, 0; i < len(img.Pix); i, j = i+4, j+3 {
            a = uint16(img.Pix[i+3])
            if a != 0 {
                for k := 0; k <= 3; k++ {
                    pu16 := uint16(img.Pix[i+k])
                    buf[j+k] = byte(pu16 * 0xff / a)
                }
            }
        }
        _, err := w.Write(buf)
        return err
    }
    

    that don't trigger the bug.

    So, if it's split into 2 separated statement, it works

  2. Log in to comment