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

false positive in cycle check #96

Open
kr opened this issue Apr 21, 2023 · 0 comments · May be fixed by #95
Open

false positive in cycle check #96

kr opened this issue Apr 21, 2023 · 0 comments · May be fixed by #95

Comments

@kr
Copy link
Owner

kr commented Apr 21, 2023

Bug in cycle detection reported in #95. Thank you @alingse. This issue is to track the bug itself as opposed to the fix. Description below copied from #95.


use visited map[visit]int to check cycle might get some bad case.

the key reason was that, all the pp, p printer share a same map[visit]int

but when we process a struct refer a pointer value twice or more, this is not a cycle, it's just a repeat refer.

maybe use other helper data type for every branch when we call code pp = *p statement

maybe a slice is enough to detect.

branch 1 : [v1, v2, v3, v5]
branch 2 : [v1, v2, v3, v4]
branch 3 : [v1, v2, v3, v4, v1]

only branch3 should print a "CYCLIC REFERENCE"

@kr kr linked a pull request Apr 21, 2023 that will close this issue
@kr kr linked a pull request Apr 21, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant