-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: empty variadic function causes argument to escape #30898
Comments
The allocation comes from converting an For your three no-bug cases there is either no conversion (the I'm surprised the original case and no-bug case 3 are different. That leads me to believe this issue should be fixable. |
Very weird that the explicit slice case is different from the implicit slice case. Makes me think we should be normalizing that earlier on in the compiler. |
@mdempsky Great minds think alike. |
CL 168238 is an experimental take at normalizing variadic calls during typechecking. It still fails a handful of regress tests. Most of them look harmless, though the uintptrescapes2.go changes are worth a double look. Notably, it eliminates the convT64 call as expected. |
I think this issue has been fixed by @mdempsky's escape analysis rewrite. |
@marigonzes Indeed it does. If someone wants to add a regress test that would be great. |
Change https://golang.org/cl/172422 mentions this issue: |
What version of Go are you using (
go version
)?Tested with latest release and latest master:
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
No memory allocations.
What did you see instead?
./example.go:9:9: value escapes to heap
CALL runtime.convT64(SB)
The issue goes away if debugf signature is changed to
debugf(format string, args ...int)
,debugf(format string, arg interface{})
, ordebugf(format string, args []interface{})
and the slice is created explicitly by the caller.The text was updated successfully, but these errors were encountered: