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: autotmp_* variables make the compiler crash #17240

Closed
randall77 opened this issue Sep 26, 2016 · 9 comments
Closed

cmd/compile: autotmp_* variables make the compiler crash #17240

randall77 opened this issue Sep 26, 2016 · 9 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@randall77
Copy link
Contributor

package main
func f(autotmp_foo int) int {
    return autotmp_foo
}

The compiler fails with:

internal compiler error: Treating auto as if it were arg, func f, node autotmp_foo, value v7

We should really keep track of which variables are autos with PAUTO, not with the name.

@randall77 randall77 added the NeedsFix The path to resolution is known, but the work has not been done. label Sep 26, 2016
@randall77 randall77 added this to the Go1.8 milestone Sep 26, 2016
@dr2chase
Copy link
Contributor

The test could also be removed; if you let it through, it causes a mystifying crash in the register allocator, so the only purpose of this check was to remove mystery. P(crash happening again) I think is relatively low, since we haven't to my knowledge run into this again since inserting the earlier check.

@mdempsky
Copy link
Member

Do we have to use "autotmp_" as the prefix for compiler-generated temporaries? Can we use some impossible prefix instead? E.g., "autotmp."?

We could use something shorter, and it would probably reduce object file / DWARF info sizes. GCC uses ".L" for generated labels in assembly output.

@randall77
Copy link
Contributor Author

There are a few other cases of strings.HasPrefix(..., "autotmp_") in the compiler, not just the one that caused this ICE. We should probably fix them all.

@rsc rsc modified the milestones: Go1.9Early, Go1.8 Oct 21, 2016
@odeke-em
Copy link
Member

@randall77, I can't seem to reproduce the crash on tip 0e7f970

$ go run main.go && cat main.go 
package main
func f(autotmp_foo int) int {
    return autotmp_foo
}
func main() {
}

I was looking at fixing all the strings.HasPrefix(..., "autotmp_") calls but can't reproduce the crash.

@josharian
Copy link
Contributor

Related / possible duplicate: #7923

@randall77
Copy link
Contributor Author

Yes, my particular example seems to have fixed itself.
The general issue stands though, we shouldn't use variable names to affect behavior. But fixing it using Matthew's suggestion (an impossible prefix) would be ok, I guess.

@dr2chase
Copy link
Contributor

I'm looking at using Than's abandoned change, for this and for #17644

@gopherbot
Copy link

CL https://golang.org/cl/32255 mentions this issue.

@gopherbot
Copy link

CL https://golang.org/cl/32419 mentions this issue.

@golang golang locked and limited conversation to collaborators Oct 31, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

7 participants