Skip to content

cmd/compile: -gcflags="-m=2 -d=ssa/check_bce/debug=1" sometimes results in no output #73892

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

Open
RaduBerinde opened this issue May 27, 2025 · 9 comments
Assignees
Labels
BugReport Issues describing a possible bug in the Go implementation. compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@RaduBerinde
Copy link
Contributor

Go version

go version go1.24.3 darwin/arm64

Output of go env in your module/workspace:

AR='ar'
CC='clang'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='clang++'
GCCGO='gccgo'
GO111MODULE='on'
GOARCH='arm64'
GOARM64='v8.0'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/Users/radu/Library/Caches/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/Users/radu/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/x0/5yrxw_4s271g705vjscld23c0000gq/T/go-build680255877=/tmp/go-build -gno-record-gcc-switches -fno-common'
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMOD='/Users/radu/go/src/github.com/cockroachdb/pebble/go.mod'
GOMODCACHE='/Users/radu/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/radu/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/Users/radu/go/pkg/mod/golang.org/[email protected]'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/radu/Library/Application Support/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/Users/radu/go/pkg/mod/golang.org/[email protected]/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.24.3'
GOWORK=''
PKG_CONFIG='pkg-config'

What did you do?

In the Pebble (github.com/cockroachdb/pebble) master branch:

go build -gcflags="-m=2 -d=ssa/check_bce/debug=1" ./sstable/colblk

Note that we use this output (through github.com/jordanlewis/gcassert) for a linter that verifies that certain known hot paths are inlined.

What did you see happen?

The command outputs nothing.

What did you expect to see?

In go1.24.2 or older, I get a ton of information: https://gist.github.com/RaduBerinde/87145c7327fdf035de9a0008f4d841c5

@RaduBerinde RaduBerinde changed the title import/path: issue title compiler: builder with gcflags outputs nothing on a certain package May 27, 2025
@RaduBerinde
Copy link
Contributor Author

Ah, interestingly go build -gcflags="-m=2" ./sstable/colblk seems to work. Maybe that -d flag is no longer valid? Seems like there should be some error output though.

@RaduBerinde
Copy link
Contributor Author

This is very strange.. but after running the variant above, the original variant started working..

@gabyhelp gabyhelp added the BugReport Issues describing a possible bug in the Go implementation. label May 27, 2025
@mknyszek mknyszek changed the title compiler: builder with gcflags outputs nothing on a certain package cmd/compile: no output with compiler options -m=2 -d=ssa/check_bce/debug=1 May 28, 2025
@mknyszek mknyszek added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 28, 2025
@mknyszek mknyszek added this to the Backlog milestone May 28, 2025
@mknyszek
Copy link
Contributor

CC @golang/compiler

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label May 28, 2025
@seankhliao seankhliao changed the title cmd/compile: no output with compiler options -m=2 -d=ssa/check_bce/debug=1 cmd/compile: -gcflags="-m=2 -d=ssa/check_bce/debug=1" sometimes results in no output May 28, 2025
@mknyszek
Copy link
Contributor

In triage we think this might be a caching issue. Something is getting cached and the output isn't getting cached and reprinted... or something.

@RaduBerinde
Copy link
Contributor Author

It would make sense. If I can find a reliable way to reproduce, I'll update this issue.

@cherrymui
Copy link
Member

Could you try if go clean -cache makes any difference? Thanks.

@RaduBerinde
Copy link
Contributor Author

I tried that but after it started working fine already... I couldn't get it to fail anymore, with or without cleaning the cache.

@randall77
Copy link
Contributor

The last paragraph of https://go-review.googlesource.com/c/go/+/128903, which fixed a bug like this a while ago, says:

This CL brings back the compiler and linker output in those two cases,
provided it can be found in the build cache. If it can't be found in the
build cache, then the go command still reuses the binaries and avoids
the compile/link/test steps. (It's not worth doing all that work again
just to repeat diagnostic output.)

I can use this to reproduce the behavior you're seeing. I'm not sure if this was the cause of what you saw, but maybe?

> cd <someproject>
> go build -gcflags="-m=2 -d=ssa/check_bce/debug=1"
... lots of debug output ...
> go clean -cache
> go build -gcflags="-m=2 -d=ssa/check_bce/debug=1"
... no debug output ...

In particular, you have to clean the cache but don't delete the binary produced in step 2.

Note that this happens just as well with -m=2 only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BugReport Issues describing a possible bug in the Go implementation. compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
Development

No branches or pull requests

6 participants