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: inliner can lose side effects #42703

Closed
mdempsky opened this issue Nov 18, 2020 · 1 comment
Closed

cmd/compile: inliner can lose side effects #42703

mdempsky opened this issue Nov 18, 2020 · 1 comment

Comments

@mdempsky
Copy link
Member

This program should print "1 2" but only prints "2" when inlining is enabled:

package main

func main()     { f()() }
func f() func() { println(1); return g }
func g()        { println(2) }

The problem is when we replace f()() with a direct call to g(), we fail to preserve the side effects from evaluating f().

Pointed out by @danscales.

@mdempsky mdempsky added this to the Go1.16 milestone Nov 18, 2020
@mdempsky mdempsky self-assigned this Nov 18, 2020
@gopherbot
Copy link

Change https://golang.org/cl/271219 mentions this issue: cmd/compile: fix miscompilation during inlining

@golang golang locked and limited conversation to collaborators Nov 18, 2021
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

2 participants