Skip to content

zkDSL compiler bug #114

@TomWambsgans

Description

@TomWambsgans

The following produces an invalid output, the reason being that the compiler always adds variables declaration for the return values of inlined calls, while it should not if the variable has already been declared before.

#[test]
fn bug() {
    let program = r#"
    fn main() {
        x = func();
        return;
    }
    fn func() -> 1 {
        var a;
        if 0 == 0 {
            a = aux();
        }
        return a;
    }

    fn aux() inline -> 1 {
        return 1;
    }
    "#;
    compile_and_run(program.to_string(), (&[], &[]), DEFAULT_NO_VEC_RUNTIME_MEMORY, false);
}

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