From 8a5ac30e2c94dc952a990bfe9207c9b1cc677751 Mon Sep 17 00:00:00 2001 From: fcarreiro Date: Fri, 10 Jan 2025 17:46:22 +0000 Subject: [PATCH] more gcc fixes --- .../cpp/src/barretenberg/vm2/simulation/execution.cpp | 4 ++-- .../cpp/src/barretenberg/vm2/simulation/lib/raw_data_db.cpp | 4 ++++ .../cpp/src/barretenberg/vm2/simulation/lib/serialization.cpp | 1 + .../cpp/src/barretenberg/vm2/tracegen/lib/lookup_builder.hpp | 3 +++ .../src/barretenberg/vm2/tracegen/lib/permutation_builder.hpp | 1 + 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/execution.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/execution.cpp index 5e9ee473f83..a0500e1de26 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/execution.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/execution.cpp @@ -29,7 +29,7 @@ void Execution::mov(ContextInterface& context, MemoryAddress src_addr, MemoryAdd { auto& memory = context.get_memory(); auto [value, tag] = memory.get(src_addr); - memory.set(dst_addr, std::move(value), tag); + memory.set(dst_addr, value, tag); } // TODO: This will need to happen in its own gadget in any case. @@ -40,7 +40,7 @@ void Execution::call(ContextInterface& context, MemoryAddress addr) const auto [contract_address, _] = memory.get(addr); std::vector calldata = {}; - auto nested_context = context_provider.make(std::move(contract_address), + auto nested_context = context_provider.make(contract_address, /*msg_sender=*/context.get_address(), /*calldata=*/calldata, /*is_static=*/false); diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/lib/raw_data_db.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/lib/raw_data_db.cpp index 034a0d7352c..d12eca2bc2f 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/lib/raw_data_db.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/lib/raw_data_db.cpp @@ -15,6 +15,8 @@ ContractInstance HintedRawDataDB::get_contract_instance(const AztecAddress& addr assert(contract_instances_idx < contract_instances.size()); auto contract_instance_hint = contract_instances[contract_instances_idx]; assert(contract_instance_hint.address == address); + (void)address; // Avoid GCC unused parameter warning when asserts are disabled. + return { .address = contract_instance_hint.address, .salt = contract_instance_hint.salt, @@ -40,6 +42,8 @@ ContractClass HintedRawDataDB::get_contract_class(const ContractClassId& class_i assert(class_id == compute_contract_class_id(contract_class_hint.artifactHash, contract_class_hint.privateFunctionsRoot, contract_class_hint.publicBytecodeCommitment)); + (void)class_id; // Avoid GCC unused parameter warning when asserts are disabled. + return { .artifact_hash = contract_class_hint.artifactHash, .private_function_root = contract_class_hint.privateFunctionsRoot, diff --git a/barretenberg/cpp/src/barretenberg/vm2/simulation/lib/serialization.cpp b/barretenberg/cpp/src/barretenberg/vm2/simulation/lib/serialization.cpp index 6488caec2f9..619f5db9ff8 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/simulation/lib/serialization.cpp +++ b/barretenberg/cpp/src/barretenberg/vm2/simulation/lib/serialization.cpp @@ -332,6 +332,7 @@ Instruction decode_instruction(std::span bytecode, size_t pos) const auto starting_pos = pos; assert(pos < bytecode_length); + (void)bytecode_length; // Avoid GCC unused parameter warning when asserts are disabled. // if (pos >= length) { // info("Position is out of range. Position: " + std::to_string(pos) + // " Bytecode length: " + std::to_string(length)); diff --git a/barretenberg/cpp/src/barretenberg/vm2/tracegen/lib/lookup_builder.hpp b/barretenberg/cpp/src/barretenberg/vm2/tracegen/lib/lookup_builder.hpp index 4ab6c26ab92..350d04b0a86 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/tracegen/lib/lookup_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/tracegen/lib/lookup_builder.hpp @@ -26,6 +26,7 @@ template class BaseLookupTraceBuilder { // The complexity is O(|src_selector|) * O(find_in_dst). trace.visit_column(LookupSettings::SRC_SELECTOR, [&](uint32_t row, const FF& src_sel_value) { assert(src_sel_value == 1); + (void)src_sel_value; // Avoid GCC complaining of unused parameter when asserts are disabled. auto src_values = trace.get_multiple(LookupSettings::SRC_COLUMNS, row); uint32_t dst_row = find_in_dst(src_values); // Assumes an efficient implementation. @@ -63,6 +64,8 @@ template class LookupIntoDynamicTable : public BaseLo row_idx.reserve(trace.get_column_rows(LookupSettings::DST_SELECTOR)); trace.visit_column(LookupSettings::DST_SELECTOR, [&](uint32_t row, const FF& dst_sel_value) { assert(dst_sel_value == 1); + (void)dst_sel_value; // Avoid GCC complaining of unused parameter when asserts are disabled. + auto dst_values = trace.get_multiple(LookupSettings::DST_COLUMNS, row); row_idx.insert({ get_key(dst_values), row }); }); diff --git a/barretenberg/cpp/src/barretenberg/vm2/tracegen/lib/permutation_builder.hpp b/barretenberg/cpp/src/barretenberg/vm2/tracegen/lib/permutation_builder.hpp index 0659f928bfc..3a8d7f66d41 100644 --- a/barretenberg/cpp/src/barretenberg/vm2/tracegen/lib/permutation_builder.hpp +++ b/barretenberg/cpp/src/barretenberg/vm2/tracegen/lib/permutation_builder.hpp @@ -21,6 +21,7 @@ template class PermutationBuilder { // Let "src_sel {c1, c2, ...} is dst_sel {d1, d2, ...}" be a permutation. trace.visit_column(PermutationSettings::SRC_SELECTOR, [&](uint32_t row, const FF& src_sel_value) { assert(src_sel_value == 1); + (void)src_sel_value; // Avoid GCC complaining of unused parameter when asserts are disabled. // We set a dummy value in the inverse column so that the size of the column is right. // The correct value will be set by the prover.