Skip to content

Commit

Permalink
fix(compiler): segfault in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aPere3 committed Jul 8, 2024
1 parent 8ddb4c6 commit 376a65d
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ Result<TestProgram> setupTestProgram(std::string source,
auto outputs = circuitEncoding.asBuilder().initOutputs(1);
circuitEncoding.asBuilder().setName(funcname);

auto encodingInfo = Message<concreteprotocol::EncodingInfo>().asBuilder();
encodingInfo.initShape();
auto integer = encodingInfo.getEncoding().initIntegerCiphertext();
auto encodingInfo = Message<concreteprotocol::EncodingInfo>();
encodingInfo.asBuilder().initShape();
auto integer = encodingInfo.asBuilder().getEncoding().initIntegerCiphertext();
integer.getMode().initNative();
integer.setWidth(3);
integer.setIsSigned(false);

inputs.setWithCaveats(0, encodingInfo);
inputs.setWithCaveats(1, encodingInfo);
outputs.setWithCaveats(0, encodingInfo);
inputs.setWithCaveats(0, encodingInfo.asReader());
inputs.setWithCaveats(1, encodingInfo.asReader());
outputs.setWithCaveats(0, encodingInfo.asReader());

options.encodings = Message<concreteprotocol::ProgramEncodingInfo>();
options.encodings->asBuilder().initCircuits(1).setWithCaveats(
Expand All @@ -61,14 +61,14 @@ Result<TestProgram> setupTestProgram(std::string source,
TEST(Encodings_unit_tests, multi_key) {
std::string source = R"(
func.func @main(
%arg0: !TFHE.glwe<sk<1,1,2048>>,
%arg0: !TFHE.glwe<sk<1,1,2048>>,
%arg1: !TFHE.glwe<sk<2,1,2048>>
) -> !TFHE.glwe<sk<2,1,2048>> {
%0 = "TFHE.keyswitch_glwe"(%arg0) {key=#TFHE.ksk<sk<1,1,2048>, sk<2, 1,2048>, 7, 2>} : (!TFHE.glwe<sk<1, 1, 2048>>) -> !TFHE.glwe<sk<2, 1, 2048>>
%1 = "TFHE.add_glwe"(%arg1, %0) : (!TFHE.glwe<sk<2,1,2048>>, !TFHE.glwe<sk<2,1,2048>>) -> !TFHE.glwe<sk<2,1,2048>>
return %1 : !TFHE.glwe<sk<2,1,2048>>
}
)";
ASSERT_ASSIGN_OUTCOME_VALUE(circuit, setupTestProgram(source));
Expand Down

0 comments on commit 376a65d

Please sign in to comment.