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: go/defer call of external or //go:uintptrescapes function does not protect unsafe.Pointer arguments #38581

Closed
mdempsky opened this issue Apr 22, 2020 · 1 comment
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@mdempsky
Copy link
Contributor

This test program currently prints "ok FAIL FAIL ok ok": https://play.golang.org/p/KEf2cpdL_mA

@ianlancetaylor and I think unsafe.Pointer's safety rule 4 requires it to print "ok ok ok ok ok". Probably by rewriting the 2nd and 3rd call forms into the 4th and 5th, respectively.

We already have a similar rewrite for handling "go builtin(...)" and "defer builtin(...)", but that doesn't happen until "walk", but currently we handle keepalive in "order". We also handle //go:uintptrescapes calls in escape analysis, so it would be nice to rewrite before then too... except escape analysis is currently responsible for marking //go:uintptrescapes and "unsafe uintptr" assembly parameters.

Low priority. Not known to affect any real world code at the moment. I discovered this while exploring possible frontend simplification work.

@mdempsky mdempsky added the NeedsFix The path to resolution is known, but the work has not been done. label Apr 22, 2020
@mdempsky mdempsky added this to the Unplanned milestone Apr 22, 2020
@mdempsky
Copy link
Contributor Author

mdempsky commented Apr 22, 2020

@cuonglm points out this is a duplicate of #24491.

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

2 participants