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

ponies: Compiler doesn't warn on statically knowable bounds errors. #156

Closed
gopherbot opened this issue Nov 13, 2009 · 12 comments
Closed

ponies: Compiler doesn't warn on statically knowable bounds errors. #156

gopherbot opened this issue Nov 13, 2009 · 12 comments

Comments

@gopherbot
Copy link

by alexjray.ncsu:

Before filing a bug, please check whether it has been fixed since
the latest release: run "hg pull -u" and retry what you did to
reproduce the problem.  Thanks.

What steps will reproduce the problem?
1. v := make([]string,4)
2. v[5] = "foo"
3. compile & run

What is the expected output? What do you see instead?
Compiler issue some kind of warning. Nothing (compiles fine).
When run, generates a stacktrace.

What is your $GOOS? linux $GOARCH? 386


Which revision are you sync'ed to?  (hg log -l 1)
changeset:   4030:52ad1606d994
tag:         tip
user:        Rob Pike <r@golang.org>
date:        Fri Nov 13 13:15:18 2009 -0800
summary:     Explain why


Please provide any additional information below.

Attachments:

  1. foo.go (229 bytes)
@agl
Copy link
Contributor

agl commented Nov 13, 2009

Comment 1:

Status changed to Accepted.

@robpike
Copy link
Contributor

robpike commented Nov 14, 2009

Comment 2:

Status changed to LongTerm.

@rsc
Copy link
Contributor

rsc commented Dec 2, 2009

Comment 3:

Labels changed: added compilerbug.

@rsc
Copy link
Contributor

rsc commented Dec 9, 2011

Comment 4:

Labels changed: added priority-later.

@rsc
Copy link
Contributor

rsc commented Jan 29, 2012

Comment 6:

Labels changed: added priority-someday, removed priority-later.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 7:

Labels changed: added repo-main.

@rsc
Copy link
Contributor

rsc commented Mar 3, 2014

Comment 8:

Adding Release=None to all Priority=Someday bugs.

Labels changed: added release-none.

@rsc
Copy link
Contributor

rsc commented Apr 10, 2015

Moving priority-someday to the Unplanned milestone.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@odeke-em
Copy link
Member

Should we change the title of this bug to categorize it under "cmd/compile: ". What does "Ponies: " mean?
/cc @josharian @bradfitz

@mdempsky
Copy link
Member

"Ponies" is how we used to label long-term hopeful feature requests.

This seems like a feature we could probably implement in the compiler today using SSA. I think that would go against our "no warnings" policy though.

@odeke-em
Copy link
Member

Thanks for the explanation @mdempsky.

@josharian
Copy link
Contributor

Yes, I think we know enough to detect this case at compile time now. But as we don't have compiler warnings, and refusing the compile the code would be wrong, the only thing we could do here is compile this code more efficiently. Since it's just going to panic anyway, and no one will ever write this code with intent to actually use it, there's no point.

If there's anywhere this belongs, it is vet. With help from SSA this should be detectable. I wonder how common it is. In any case, that should be a separate issue (feel free to open one, anyone). Closing this one.

@golang golang locked and limited conversation to collaborators Sep 12, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants