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/gofmt: silently turns invalid program into a valid one (full slice expression) #7305

Closed
cznic opened this issue Feb 11, 2014 · 3 comments
Closed
Assignees
Milestone

Comments

@cznic
Copy link
Contributor

@cznic cznic commented Feb 11, 2014

What steps will reproduce the problem?


1. Have an invalid program (does not compile):
package main // http://play.golang.org/p/s7Xg5T3zf4

func main() {
        _ = []int{}[0:0:] // <- missing mandatory max
}


2. Click the "Format" button.


3. Click the "Run" button


What is the expected output?
prog.go:4: final index required in 3-index slice
 [process exited with non-zero status]


What do you see instead?
[no output]


Which compiler are you using (5g, 6g, 8g, gccgo)?
N/A


Which operating system are you using?
N/A


Which version are you using?  (run 'go version')
N/A


Please provide any additional information below.
The semantics of [l:h] and [l:h:m] differs enough to possibly get any/undefined behavior
from the new "valid" code.
@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Feb 11, 2014

Comment 1:

Nice find.

Labels changed: added release-go1.3, repo-main.

Owner changed to @griesemer.

Status changed to Accepted.

@griesemer
Copy link
Contributor

@griesemer griesemer commented Feb 11, 2014

Comment 2:

Status changed to Started.

@griesemer
Copy link
Contributor

@griesemer griesemer commented Feb 11, 2014

Comment 3:

This issue was closed by revision 13a5958.

Status changed to Fixed.

@cznic cznic added fixed labels Feb 11, 2014
@rsc rsc added this to the Go1.3 milestone Apr 14, 2015
@rsc rsc removed the release-go1.3 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.