Skip to content

Commit

Permalink
4304 - fix uninitialization of some std::array's
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanmon committed Feb 6, 2024
1 parent 840750e commit 889da01
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ FF AvmMiniAluTraceBuilder::add(FF const& a, FF const& b, AvmMemoryTag in_tag, ui
bool carry = false;
uint8_t alu_u8_r0 = 0;
uint8_t alu_u8_r1 = 0;
std::array<uint16_t, 8> alu_u16_reg;
std::array<uint16_t, 8> alu_u16_reg{}; // Must be zero-initialized (FF tag case)

uint128_t a_u128{ a };
uint128_t b_u128{ b };
Expand Down Expand Up @@ -140,7 +140,7 @@ FF AvmMiniAluTraceBuilder::sub(FF const& a, FF const& b, AvmMemoryTag in_tag, ui
bool carry = false;
uint8_t alu_u8_r0 = 0;
uint8_t alu_u8_r1 = 0;
std::array<uint16_t, 8> alu_u16_reg;
std::array<uint16_t, 8> alu_u16_reg{}; // Must be zero-initialized (FF tag case)
uint128_t a_u128{ a };
uint128_t b_u128{ b };
uint128_t c_u128 = a_u128 - b_u128;
Expand Down Expand Up @@ -225,7 +225,7 @@ FF AvmMiniAluTraceBuilder::mul(FF const& a, FF const& b, AvmMemoryTag in_tag, ui
uint8_t alu_u8_r0 = 0;
uint8_t alu_u8_r1 = 0;

std::array<uint16_t, 8> alu_u16_reg;
std::array<uint16_t, 8> alu_u16_reg{}; // Must be zero-initialized (FF tag case)

uint128_t a_u128{ a };
uint128_t b_u128{ b };
Expand Down Expand Up @@ -258,8 +258,8 @@ FF AvmMiniAluTraceBuilder::mul(FF const& a, FF const& b, AvmMemoryTag in_tag, ui
uint128_t c_u128 = a_u128 * b_u128;

// Decompose a_u128 and b_u128 over 8 16-bit registers.
std::array<uint16_t, 8> alu_u16_reg_a;
std::array<uint16_t, 8> alu_u16_reg_b;
std::array<uint16_t, 8> alu_u16_reg_a; // Will be initialized in for loop below.
std::array<uint16_t, 8> alu_u16_reg_b; // Will be initialized in for loop below.
uint128_t a_trunc_128 = a_u128;
uint128_t b_trunc_128 = b_u128;

Expand Down

0 comments on commit 889da01

Please sign in to comment.