-
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: bad order of evaluation for multi-value f(g()) calls #50672
Comments
It seems to me that we should evaluate |
@cuonglm Yeah, rewriting as Longer term, I think we should probably incorporate order.go directly into unified IR. |
Is the order of evaluation actually specified here, or is this another case like #27804? https://go.dev/ref/spec#Order_of_evaluation says:
I guess in this case |
Yeah, /cc @griesemer @ianlancetaylor in case they interpret the spec differently here |
Yes, I think the call to I think this differs from #27804 which hinges on when we evaluate a variable in a tuple assignment. The gc compiler got this right up to version 1.12. In version 1.13 it started failing. Possibly due to CL 114797; CC @josharian . |
I suspect CL 166983 (c0cfe96) is a more likely culprit. |
Note that the rewriting of |
Change https://go.dev/cl/392834 mentions this issue: |
This program panics when compiled with cmd/compile, but should succeed:
This is because we rewrite
f()(g())
intot1, t2 := g(); f()(t1, t2)
during type checking.gccgo compiles it correctly.
The text was updated successfully, but these errors were encountered: