From 3330b2f8552ac439af28fd11222b65fe26b3e6a3 Mon Sep 17 00:00:00 2001 From: Quentin Bourgerie Date: Fri, 11 Feb 2022 15:00:33 +0100 Subject: [PATCH] fix(compiler): Take care of program with no input when creating client parameters --- compiler/lib/Support/V0ClientParameters.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/compiler/lib/Support/V0ClientParameters.cpp b/compiler/lib/Support/V0ClientParameters.cpp index a313aa12c..ffd584032 100644 --- a/compiler/lib/Support/V0ClientParameters.cpp +++ b/compiler/lib/Support/V0ClientParameters.cpp @@ -143,9 +143,14 @@ createClientParametersForV0(V0FHEContext fheContext, // Create input and output circuit gate parameters auto funcType = (*funcOp).getType(); - bool hasContext = funcType.getInputs() - .back() - .isa(); + + auto inputs = funcType.getInputs(); + + bool hasContext = + inputs.empty() + ? false + : inputs.back().isa(); + for (auto inType = funcType.getInputs().begin(); inType < funcType.getInputs().end() - hasContext; inType++) { auto gate =