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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions