go: cmd/compile: "offset too large" error

What version of Go are you using (go version)?

go version go1.9 windows/amd64

Does this issue reproduce with the latest release?

What operating system and processor architecture are you using (go env)?

go env set GOARCH=amd64 set GOBIN= set GOEXE=.exe set GOHOSTARCH=amd64 set GOHOSTOS=windows set GOOS=windows set GOPATH=d:\dev\go\meijing;d:\dev\tpt_vendor;d:\dev\Godeps_workspace set GORACE= set GOROOT=d:\tools\go_amd64 set GOTOOLDIR=d:\tools\go_amd64\pkg\tool\windows_amd64 set GCCGO=gccgo set CC=gcc set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\xxxx\AppData\Local\Temp\go-build851261075=/tmp/go-build -gno-record-gcc-switches set CXX=g++ set CGO_ENABLED=1 set CGO_CFLAGS=-g -O2 set CGO_CPPFLAGS= set CGO_CXXFLAGS=-g -O2 set CGO_FFLAGS=-g -O2 set CGO_LDFLAGS=-g -O2 set PKG_CONFIG=pkg-config

What did you do?

I compile my app, it is ok on go1.8 or go1.7 code is:

default

What did you expect to see?

it is compile ok.

What did you see instead?

cn/com/hengwei/poller

.\alert_action.go:448:2: offset too large in 02217 (d:\dev\meijing\src\cn\com\hengwei\poller\alert_action.go:428) MOVQ -17179868768(BX)(AX8),BX .\alert_action.go:448:2: offset too large in 03783 (d:\dev\meijing\src\cn\com\hengwei\poller\alert_action.go:430) MOVQ -17179868768(DX)(CX8),DX FAIL cn/com/hengwei/poller [build failed]

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 19 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Please don’t send me anything. I have reported on compiler bugs before. You should be able to use process of elimination to eventually trim the problem down to a snippet that is safe to share. For example, #20333.

package abc

import (
	"math"
)

const current_status_internal_start = math.MaxInt32 - 50

func gen_message(ss []*string, current int) string {
	s := ss[current-current_status_internal_start]
	if nil != s {
		return ""
	}

	switch current {
	case 0:
		return "a"
	default:
		return "b"
	}
}

main.zip

D:\developing\go\meijing\src\abc>go build
# abc
.\main.go:15:2: offset too large in 00039 (d:\developing\go\meijing\src\abc\main.go:10) MOVQ    -17179868776(CX)(AX*8), CX

it is ok on the linux.