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/compile: double error when break is not in a loop #51456

Open
alicebob opened this issue Mar 3, 2022 · 1 comment
Open

cmd/compile: double error when break is not in a loop #51456

alicebob opened this issue Mar 3, 2022 · 1 comment
Labels
NeedsInvestigation
Milestone

Comments

@alicebob
Copy link
Contributor

@alicebob alicebob commented Mar 3, 2022

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

go version devel go1.19-d3fe4e193e Thu Mar 3 16:02:44 2022 +0000 linux/amd64

and

go version go1.18rc1 linux/amd64

Does this issue reproduce with the latest release?

(edit) No, on 1.17.7 it's a single error.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/harmen/.cache/go-build"
GOENV="/home/harmen/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/harmen/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/harmen/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/harmen/src/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/harmen/src/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="devel go1.19-d3fe4e193e Thu Mar 3 16:02:44 2022 +0000"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2287321463=/tmp/go-build -gno-record-gcc-switches"

What did you do?

package main

func main() {
	break
}

https://go.dev/play/p/pyIH7X9EZMT?v=gotip

What did you expect to see?

A single error

What did you see instead?

harmen@umount:/tmp$ go run foo.go
# command-line-arguments
./foo.go:4:2: break is not in a loop, switch, or select
./foo.go:4:2: break is not in a loop, switch, or select statement
harmen@umount:/tmp$ 
@alicebob alicebob changed the title affected/package: double error when break is not in a loop cmd/compile: double error when break is not in a loop Mar 3, 2022
@ALTree ALTree added the NeedsInvestigation label Mar 3, 2022
@ALTree ALTree added this to the Go1.19 milestone Mar 3, 2022
@ALTree
Copy link
Member

@ALTree ALTree commented Mar 3, 2022

Thanks for reporting this. Tentatively putting it in the 1.19 milestone because it's a (non-serious) 1.18 regression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation
Projects
None yet
Development

No branches or pull requests

2 participants