NilFoundation / zkLLVM

Zero-Knowledge Proof Systems Circuit Compiler
https://docs.nil.foundation/zkllvm
285 stars 48 forks source link

[Possible bug] constexpr requires integer operands in nested if #529

Closed CblPOK-git closed 7 months ago

CblPOK-git commented 7 months ago

Describe the bug Circifier fails when trying to compile example

To Reproduce

`#include <nil/crypto3/algebra/curves/pallas.hpp>

using namespace nil::crypto3::algebra::curves;

[[circuit]] typename pallas::base_field_type::value_type nested_if( typename pallas::base_field_type::value_type a, typename pallas::base_field_type::value_type b ) { if (a == 1) { if (b == 3) { return a + b; } } return 0; } `

Backtrace [build] /home/cblpok/zkllvm_1/zkLLVM/build/libs/circifier/llvm/bin/llvm-link: nested_if_cpp_example_no_stdlib_nested_if.cpp.ll:31:55: error: constexpr requires integer operands [build] %. = select i1 %or.cond, __zkllvm_field_pallas_base add (__zkllvm_field_pallas_base f0x1, __zkllvm_field_pallas_base f0x3), __zkllvm_field_pallas_base f0x0 [build] ^ [build] /home/cblpok/zkllvm_1/zkLLVM/build/libs/circifier/llvm/bin/llvm-link: error: loading file 'nested_if_cpp_example_no_stdlib_nested_if.cpp.ll' [build] ninja: build stopped: subcommand failed. [proc] The command: /usr/bin/cmake --build /home/cblpok/zkllvm_1/zkLLVM/build --config Debug --target nested_if_cpp_example -- exited with code: 1 [driver] Build completed: 00:00:45.602 [build] Build finished with exit code 1