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

handle the unify-by-value semantics in the EAR pointer analysis #314

Open
guodongli-google opened this issue Jun 15, 2021 · 0 comments
Open
Labels
bug Something isn't working

Comments

@guodongli-google
Copy link
Contributor

Bug report

Go's objects are copy-by-value by default, so copying a struct (or an array) actually copying its elements rather than the reference of the struct. The EAR analysis ("earpointer/analysis.go") approximates this using copy-by-reference. For example,

type T1 struct { ... }

type T2 struct {
  x T1
  y *int
}

func f(t2 T2) {
  t3 := t2
  ...
}

Currently the analysis unifies t3 and t2 to be {t2, t3}. However w.r.t. the exact semantics we should have {t3.y, t2.y}, and t2.x and t3.x should be unified recursively.
This approximation may lead to false positives.

@guodongli-google guodongli-google added the bug Something isn't working label Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant