-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.Performancecompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Milestone
Description
Go version
go1.24-793b14b455
Output of go env in your module/workspace:
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/tmp/go-build'
GOENV='/home/hugo/.config/go/env'
GOEXE=''
GOEXPERIMENT='rangefunc'
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/hugo/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/hugo/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/hugo/k/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/home/hugo/k/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='devel go1.24-793b14b455 Tue Aug 13 17:23:56 2024 +0200 X:rangefunc'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/hugo/.config/go/telemetry'
GCCGO='/usr/bin/gccgo'
GOAMD64='v3'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/hugo/k/go/src/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build127661744=/tmp/go-build -gno-record-gcc-switches'What did you do?
Add theses in test/prove.go and run:
func mod64uWithSmallerDividendMax(a, b uint64, ensureBothBranchesCouldHappen bool) int {
a &= 0xff
b &= 0xfff
z := bits.Len64(a % b)
if ensureBothBranchesCouldHappen {
if z > bits.Len64(0xff) { // ERROR "Disproved Less64$"
return 42
}
} else {
if z <= bits.Len64(0xff) { // ERROR "Proved Leq64$"
return 1337
}
}
return z
}
func mod64uWithSmallerDivisorMax(a, b uint64, ensureBothBranchesCouldHappen bool) int {
a &= 0xfff
b &= 0x10 // we need bits.Len64(b.umax) != bits.Len64(b.umax-1)
z := bits.Len64(a % b)
if ensureBothBranchesCouldHappen {
if z > bits.Len64(0x10-1) { // ERROR "Disproved Less64$"
return 42
}
} else {
if z <= bits.Len64(0x10-1) { // ERROR "Proved Leq64$"
return 1337
}
}
return z
}
func mod64uWithIdenticalMax(a, b uint64, ensureBothBranchesCouldHappen bool) int {
a &= 0x10
b &= 0x10 // we need bits.Len64(b.umax) != bits.Len64(b.umax-1)
z := bits.Len64(a % b)
if ensureBothBranchesCouldHappen {
if z > bits.Len64(0x10-1) { // ERROR "Disproved Less64$"
return 42
}
} else {
if z <= bits.Len64(0x10-1) { // ERROR "Proved Leq64$"
return 1337
}
}
return z
}What did you see happen?
--- FAIL: Test (0.02s)
--- FAIL: Test/prove.go (0.31s)
testdir_test.go:145:
prove.go:1436: missing error "Disproved Less64$"
prove.go:1440: missing error "Proved Leq64$"
prove.go:1453: missing error "Disproved Less64$"
prove.go:1457: missing error "Proved Leq64$"
prove.go:1470: missing error "Disproved Less64$"
prove.go:1474: missing error "Proved Leq64$"
FAIL
FAIL cmd/internal/testdir 0.336s
FAIL
What did you expect to see?
ok cmd/internal/testdir 0.350s
Metadata
Metadata
Assignees
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.Performancecompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Type
Projects
Status
Done