Skip to content

Bug: % by zero panics the compiler #419

Description

@anon-researchers-123

Expected behavior

A compile-time % with a zero divisor should emit a clean error[T3001]
division-by-zero diagnostic, exactly like the other operators / and \ do.

The bug

% on a zero divisor panics the compiler (Rust panic, exit code 101) with no
source location, instead of emitting T3001.

template T() {
    var v = 5 % 0;   // panics
}
component main = T();
thread 'main' panicked at num-bigint-dig-0.8.4/src/algorithms/div.rs:38:9: explicit panic
circom exit status: 101

For contrast, var v = 5 / 0; in the same position emits error[T3001] and exits 1.

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