Skip to content

false positive in cycle check #96

@kr

Description

@kr

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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions