Skip to content

Bug: template recursion crashes Circom #420

Description

@anon-researchers-123

Expected behavior

A cyclic template instantiation should be rejected with a clean diagnostic that names
the cycle (e.g., template instantiation cycle: A -> B -> A), not abort the process.

The bug

Two templates that instantiate each other recurse until the OS thread stack is
exhausted; the compiler aborts with a fatal runtime error: stack overflow (exit code
134) and no source location or template name.

template A() { component b = B(); }
template B() { component a = A(); }
component main = A();
thread 'main' has overflowed its stack
fatal runtime error: stack overflow, aborting
circom exit status: 134

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions