Skip to content
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

cmd/go/internal/work: panic for a repeated //go:debug directive for the same setting #62346

Open
AndrewWPhillips opened this issue Aug 29, 2023 · 1 comment
Assignees
Labels
GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@AndrewWPhillips
Copy link

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

$ go version                                 
go version go1.21.0 windows/amd64

Does this issue reproduce with the latest release?

yes

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

go env Output
$ go env
set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Andrew\AppData\Local\go-build
set GOENV=C:\Users\Andrew\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\Andrew\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\Andrew\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org
set GOROOT=C:/Users/Andrew/go/go1.21.0
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Users\Andrew\go\go1.21.0\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.21.0
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=C:\Users\Andrew\AppData\Local\Temp\go-build1748980101=/tmp/go-build -gno-record-gcc-switches

What did you do?

https://go.dev/play/p/k6MIftXQ3q7

//go:debug panicnil=1
//go:debug panicnil=1

package main

func main() {
}

What did you expect to see?

Build or compiler error message.

What did you see instead?

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x1 addr=0x20 pc=0x7ab2f7]

goroutine 36 [running]:
bytes.(*Buffer).Write(0xc00019a0d0?, {0xc000132120?, 0x38?, 0xc0001891f8?})
bytes/buffer.go:176 +0x17
fmt.Fprintf({0xe22e80, 0x0}, {0xd3c601, 0x38}, {0xc0001891f8, 0x3, 0x3})
fmt/print.go:225 +0x97
cmd/go/internal/work.(*Builder).checkDirectives(0xc0000e2000, 0x497d5c6d09af60fa?)
cmd/go/internal/work/exec.go:978 +0x4ed
cmd/go/internal/work.(*Builder).build(0xc0000e2000, {0xe28230?, 0x11f3e40?}, 0xc0003cde40)
cmd/go/internal/work/exec.go:536 +0x71d
cmd/go/internal/work.ActorFunc.Act(0xe28230?, 0x11f3e40?, {0xe28230?, 0x11f3e40?}, 0x7c206e6977726164?)
cmd/go/internal/work/action.go:78 +0x2d
cmd/go/internal/work.(*Builder).Do.func3({0xe28230, 0x11f3e40}, 0xc0003cde40)
cmd/go/internal/work/exec.go:151 +0x7e4
cmd/go/internal/work.(*Builder).Do.func4()
cmd/go/internal/work/exec.go:219 +0xa8
created by cmd/go/internal/work.(*Builder).Do in goroutine 1
cmd/go/internal/work/exec.go:205 +0x405

@gopherbot
Copy link

Change https://go.dev/cl/523836 mentions this issue: cmd/go/internal/work: avoid panic for a repeated //go:debug setting

@joedian joedian added GoCommand cmd/go NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. labels Aug 29, 2023
@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. labels Sep 5, 2023
@dmitshur dmitshur added this to the Go1.22 milestone Sep 5, 2023
@gopherbot gopherbot modified the milestones: Go1.22, Go1.23 Feb 6, 2024
@matloob matloob self-assigned this Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants