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:norace should prohibit inlining into functions that will be instrumented #24651

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

Comments

@mdempsky
Copy link
Member

mdempsky commented Apr 2, 2018

Currently, compiling this package:

package p

func F(p *int) { g(p) }

//go:norace
func g(p *int) { *p = 0 }

with "-S -race" shows that g is inlined into F, and the pointer assignment is instrumented with a race detector call, which seemingly defeats the intention of adding //go:norace.

Probably the easiest solution is that when instrumenting, we should treat //go:norace functions as non-inlinable.

Even better would be to avoid inlining //go:norace function calls only into instrumented functions (similar to how CL 102815 still allows inlining runtime calls within package runtime even during instrumented builds), but that would require tracking the //go:norace pragma across compilation units, which is a bit more involved.

/cc @cherrymui

@mdempsky mdempsky added the NeedsFix The path to resolution is known, but the work has not been done. label Apr 2, 2018
@mdempsky mdempsky added this to the Go1.11 milestone Apr 2, 2018
@dr2chase dr2chase self-assigned this Jun 15, 2018
@gopherbot
Copy link

Change https://golang.org/cl/119195 mentions this issue: cmd/compile: conditional on -race, disable inline of go:norace

@golang golang locked and limited conversation to collaborators Jun 19, 2019
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

3 participants