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: channel element type too large compiling errors are not reported for channels named with blank identifer #20027

Open
go101 opened this Issue Apr 18, 2017 · 4 comments

Comments

Projects
None yet
4 participants
@go101

go101 commented Apr 18, 2017

Please answer these questions before submitting your issue. Thanks!

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

go version go1.8.1 linux/amd64

What did you do?

// the two are ok
var _ chan [0x2FFFF]byte
var _ = make(chan [0x2FFFF]byte)

// the two: <unknown line number>: channel element type too large (>64kB)
var c1 chan [0x2FFFF]byte
var c2 = make(chan [0x2FFFF]byte)

What did you expect to see?

compiles error for the blank identifier lines

What did you see instead?

the blank identifier lines compile ok

@bradfitz

This comment has been minimized.

Member

bradfitz commented Apr 18, 2017

Why? Seems fine to me. You can't use those channels anyway, so no need reporting an unnecessary error. The errors on the named channels are because the implementation isn't able to handle them.

@bradfitz bradfitz added this to the Unplanned milestone Apr 18, 2017

@griesemer

This comment has been minimized.

Contributor

griesemer commented Apr 18, 2017

I don't think this is a bug, but I can see arguments both ways (and also compilers which might complain in both cases). @mdempsky, any thoughts?

@rsc

This comment has been minimized.

Contributor

rsc commented Jun 5, 2017

I could see an argument for not giving an error for the plain declaration, but if the make would fail to compile when assigned to c2, I don't see any argument for compiling successfully when assigned to _. Blank assignments are supposed to have all the side effects of evaluation of the rhs.

The _ assignments and c1, c2 assignments should behave the same. They do in go/types (accepts both), and here the compiler should probably reject both.

@rsc rsc added NeedsFix and removed NeedsDecision labels Jun 5, 2017

@go101

This comment has been minimized.

go101 commented May 31, 2018

@ianlancetaylor
looks gccgo compiles this program, but the output program panics

fatal error: makechan: invalid channel element type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment