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: conversion on case stmt error #52701

Closed
ddaa2000 opened this issue May 4, 2022 · 4 comments
Closed

cmd/compile: conversion on case stmt error #52701

ddaa2000 opened this issue May 4, 2022 · 4 comments
Labels
NeedsInvestigation
Milestone

Comments

@ddaa2000
Copy link

@ddaa2000 ddaa2000 commented May 4, 2022

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

$ go version
go version go1.18.1 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\ddaa\AppData\Local\go-build
set GOENV=C:\Users\ddaa\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\ddaa\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\ddaa\go
set GOPRIVATE=
set GOPROXY=https://goproxy.cn,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.18.1
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=D:\programing\go\bugReview\go.mod
set GOWORK=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\ddaa\AppData\Local\Temp\go-build2453048728=/tmp/go-build -gno-rec
ord-gcc-switches

What did you do?

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

What did you expect to see?

Compile successfully without reporting a syntax error. (Actually, this code can compile successfully by go1.11.13).

What did you see instead?

./prog.go:14:2: cannot use b (type T2) as type T1 in assignment

Go build failed.

@ddaa2000 ddaa2000 changed the title affected/package: cmd/compile: conversion on case stmt error May 4, 2022
@dr2chase dr2chase added the NeedsInvestigation label May 4, 2022
@dr2chase dr2chase added this to the Backlog milestone May 4, 2022
@dr2chase
Copy link
Contributor

@dr2chase dr2chase commented May 4, 2022

@griesemer, can you give this a look?
Also fails in 1.17, also in 1.15, that was the earliest I had handy for testing.

@ddaa2000
Copy link
Author

@ddaa2000 ddaa2000 commented May 4, 2022

I have tested and it fails from 1.12 to 1.17. (tested on 1.12, 1.12.17, 1.13.15, 1.14.15, 1.15.15, 1.16.15, 1.17.9)

@griesemer griesemer removed this from the Backlog milestone May 4, 2022
@griesemer griesemer added this to the Go1.19 milestone May 4, 2022
@griesemer
Copy link
Contributor

@griesemer griesemer commented May 4, 2022

This is a bug in the compiler's old type-checker (which is still involved to augment nodes created after type checking with compiler types). Which also explains why this bug has been around for a long time.

Marking for 1.19 for visibility.

@gopherbot
Copy link

@gopherbot gopherbot commented May 4, 2022

Change https://go.dev/cl/403997 mentions this issue: cmd/compile: fix constructing expr side-effects when comparing 0-size types

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

4 participants