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

Fix recursive type segfault in hiltic #1881

Merged
merged 1 commit into from
Oct 5, 2024

Commits on Oct 5, 2024

  1. Fix infinite loops with recursive types.

    Closes #1867
    
    There are two different cases where infinite loops happen with recursive
    types. First, a type may reference itself (`type Data = Data`). Second,
    a type may reference itself inside some other type (`type Data =
    vector<Data>`).
    
    The first is fixed with a recursion limit. Since the type simply cannot
    resolve, it doesn't get anywhere near codegen. You could detect cycles,
    but that introduces some extra overhead and complexity that shouldn't
    be needed in a "simple" function.
    
    The second is fixed with an ad-hoc "occurs" check in type unification.
    That just detects cycles and aborts if one is present. This could be
    placed at some other place in the "resolve until convergence" loop, but
    it seems best put closest to the source of the issue.
    evantypanski authored and bbannier committed Oct 5, 2024
    Configuration menu
    Copy the full SHA
    b3a3aef View commit details
    Browse the repository at this point in the history