Skip to content

math: MaxInt64 overflows int on ARM #23086

@mathuin

Description

@mathuin

Please answer these questions before submitting your issue. Thanks!

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

go version go1.9.2 linux/arm

Does this issue reproduce with the latest release?

Yes

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

GOARCH="arm"
GOBIN=""
GOEXE=""
GOHOSTARCH="arm"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/alarm/go"
GORACE=""
GOROOT="/usr/local/go1.9.2.linux-armv6l"
GOTOOLDIR="/usr/local/go1.9.2.linux-armv6l/pkg/tool/linux_arm"
GCCGO="gccgo"
GOARM="6"
CC="gcc"
GOGCCFLAGS="-fPIC -marm -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build788013818=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

What did you do?

Here is a minimum working example of the error.

package main

import (
	"math"
)

func main() {
	min := math.MaxInt64
}

What did you expect to see?

This program should generate no errors. (actually it complains that min is declared and not used, but that's not important right now)

What did you see instead?

# command-line-arguments
./mwe.go:8:6: constant 9223372036854775807 overflows int

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions