You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following arithmetic operations may result in unchecked overflow, resulting in different behavior in debug vs release compilation mode. For each of these, the desired resolution is likely (a) the overflow should wrap around, and this should be made explicit and made to happen in both debug and release mode, or (b) overflow is deemed to be impossible for all inputs, and should result in a panic with an informative error message. However, other resolutions are possible and these must be considered on a case by case basis.
In machine/src/core.rs:
a. In the implementation of Add:add for Word<u8>, on line 57
b. In the implementation of Sub::sub for Word<u8>, on line 67
In alu_u32/src/add/mod.rs:
a. In the implementation of Add32Chip::op_to_row:
i. The addition on line 108
ii. The first addition on line 109
iii. The second addition on line 109
iv. The first addition on line 113
v. The second addition on line 113
b. In the implementation of Instruction<M>::execute for Add32Instruction:
i. The addition on line 141 (computing read_addr_1)
ii. The addition on line 142 (computing write_addr_1)
iii. The addition on line 149 (computing read_addr_2)
iv. The addition on line 153 (computing a)
In cpu/src/lib.rs:
a. In Instruction<M>::execute for ReadAdviceInstruction:
i. The two additions on line 410
ii. The multiplication on line 410
b. In Instruction<M>::execute for WriteAdviceInstruction:
i. The first and second additions on line 436 (i.e., fp + mem_addr)
ii. The third addition on line 436 (i.e., (fp + mem_addr) + mem_buf_len)
c. In Instruction<M>::execute for Load32Instruction:
i. The addition on line 470 (computing read_addr_1)
ii. The addition on line 472 (computing write_addr)
d. In Instruction<M>::execute for Store32Instruction:
i. The addition on line 491 (computing read_addr)
ii. The addition on line 492 (computing write_addr)
e. In Instruction<M>::execute for JalInstruction:
i. The addition on line 512 (computing write_addr)
ii. The addition on line 513 (computing next_pc)
ii. The addition on line 518
f. In Instruction<M>::execute for JalvInstruction:
i. The addition on line 536 (computing write_addr)
ii. The addition on line 537 (computing next_pc)
iii. The addition on line 540 (computing read_addr)
iv. The addition on line 543 (computing read_addr)
v. The additive assignment on line 545
g. In Instruction<M>::execute for BeqInstruction:
i. The addition on line 562 (computing read_addr_1)
ii. The addition on line 570 (computing read_addr_2)
iii. The addition on line 576
h. In Instruction<M>::execute for BneInstruction:
i. The addition on line 594 (computing read_addr_1)
ii. The addition on line 602 (computing read_addr_2)
iii. The addition on line 608
i. In Instruction<M>::execute for Imm32Instruction:
i. The addition on line 624 (computing write_addr)
j. Every instance of state.cpu_mut().pc += 1;
k. In impl CpuChip:
i. On line 655 and 660, self.pc += 1;
ii. On line 668, self.clock += 1;
In alu_u32/src/bitwise/mod.rs:
a. In Instruction<M>::execute for Xor32Instruction:
i. The addition on line 145 (computing read_addr_1)
ii. The addition on line 146 (computing write_addr)
iii. The addition on line 153 (computing read_addr_2)
b. In Instruction<M>::execute for And32Instruction:
i. The addition on line 181 (computing read_addr_1)
ii. The addition on line 182 (computing write_addr)
iii. The addition on line 190 (computing read_addr_2)
c. In Instruction<M>::execute for Or32Instruction:
i. The addition on line 217 (computing read_addr_1)
ii. The addition on line 218 (computing write_addr)
iii. The addition on line 225 (computing read_addr_2)
In alu_u32/src/div/mod.rs, in Instruction<M>::execute for Div32Instruction:
a. The addition on line 77 (computing read_addr_1)
b. The addition on line 78 (computing write_addr)
c. The addition on line 85 (computing read_addr_2)
In alu_u32/src/lt/mod.rs, in Instruction<M>::execute for Lt32Instruction:
a. The addition on line 128 (computing read_addr_1)
b. The addition on line 129 (computing write_addr)
c. The addition on line 136 (computing read_addr_2)
In alu_u32/src/mul/mod.rs, in Instruction::execute for Mul32Instruction:
a. The addition on line 123 (computing read_addr_1)
b. The addition on line 124 (computing write_addr)
c. The addition on line 131 (computing read_addr_2)
d. The multiplication on line 135 (computing a)
In alu_u32/src/shift/mod.rs:
a. In Instruction<M>::execute for Shl32Instruction:
i. The addition on line 172 (computing read_addr_1)
ii. The addition on line 172 (computing write_addr)
iii. The addition on line 180 (computing read_addr_2)
b. In Instruction<M>::execute for Shr32Instruction:
i. The addition on line 216 (computing read_addr_1)
ii. The addition on line 217 (computing write_addr)
iii. The addition on line 224 (computing read_addr_2)
In alu_u32/src/sub/mod.rs, in Instruction<M>::execute for Sub32Instruction:
a. The addition on line 137 (computing read_addr_1)
b. The addition on line 138 (computing write_addr)
c. The addition on line 145 (computing read_addr_2)
d. The subtraction on line 149 (computing a)
In native_field/src/lib.rs:
a. In Instruction<M>::execute for AddInstruction:
i. The addition on line 157 (computing read_addr_1)
ii. The addition on line 158 (computing write_addr)
iii. The addition on line 165 (computing read_addr_2)
b. In Instruction<M>::execute for SubInstruction:
i. The addition on line 197 (computing read_addr_1)
ii. The addition on line 198 (computing write_addr)
iii. The addition on line 205 (computing read_addr_2)
c. In Instruction<M>::execute for MulInstruction:
i. The addition on line 237 (computing read_addr_1)
ii. The addition on line 238 (computing write_addr)
iii. The addition on line 245 (computing read_addr_2)
In output/src/lib.rs:
a. In Chip<M>::generate_trace for OutputChip:
i. The subtraction on line 66 (computing cols.diff)
b. In Instruction<M>::execute for WriteInstruction:
i. The addition on line 149 (computing read_addr_1)
The text was updated successfully, but these errors were encountered:
The following arithmetic operations may result in unchecked overflow, resulting in different behavior in debug vs release compilation mode. For each of these, the desired resolution is likely (a) the overflow should wrap around, and this should be made explicit and made to happen in both debug and release mode, or (b) overflow is deemed to be impossible for all inputs, and should result in a panic with an informative error message. However, other resolutions are possible and these must be considered on a case by case basis.
machine/src/core.rs
:a. In the implementation of
Add:add
forWord<u8>
, on line 57b. In the implementation of
Sub::sub
forWord<u8>
, on line 67alu_u32/src/add/mod.rs
:a. In the implementation of
Add32Chip::op_to_row
:i. The addition on line 108
ii. The first addition on line 109
iii. The second addition on line 109
iv. The first addition on line 113
v. The second addition on line 113
b. In the implementation of
Instruction<M>::execute
forAdd32Instruction
:i. The addition on line 141 (computing
read_addr_1
)ii. The addition on line 142 (computing
write_addr_1
)iii. The addition on line 149 (computing
read_addr_2
)iv. The addition on line 153 (computing
a
)a. In
Instruction<M>::execute
forReadAdviceInstruction
:i. The two additions on line 410
ii. The multiplication on line 410
b. In
Instruction<M>::execute
forWriteAdviceInstruction
:i. The first and second additions on line 436 (i.e.,
fp + mem_addr
)ii. The third addition on line 436 (i.e.,
(fp + mem_addr) + mem_buf_len
)c. In
Instruction<M>::execute
forLoad32Instruction
:i. The addition on line 470 (computing
read_addr_1
)ii. The addition on line 472 (computing
write_addr
)d. In
Instruction<M>::execute
forStore32Instruction
:i. The addition on line 491 (computing
read_addr
)ii. The addition on line 492 (computing
write_addr
)e. In
Instruction<M>::execute
forJalInstruction
:i. The addition on line 512 (computing
write_addr
)ii. The addition on line 513 (computing
next_pc
)ii. The addition on line 518
f. In
Instruction<M>::execute
forJalvInstruction
:i. The addition on line 536 (computing
write_addr
)ii. The addition on line 537 (computing
next_pc
)iii. The addition on line 540 (computing
read_addr
)iv. The addition on line 543 (computing
read_addr
)v. The additive assignment on line 545
g. In
Instruction<M>::execute
forBeqInstruction
:i. The addition on line 562 (computing
read_addr_1
)ii. The addition on line 570 (computing
read_addr_2
)iii. The addition on line 576
h. In
Instruction<M>::execute
forBneInstruction
:i. The addition on line 594 (computing
read_addr_1
)ii. The addition on line 602 (computing
read_addr_2
)iii. The addition on line 608
i. In
Instruction<M>::execute
forImm32Instruction
:i. The addition on line 624 (computing
write_addr
)j. Every instance of
state.cpu_mut().pc += 1;
k. In
impl CpuChip
:i. On line 655 and 660,
self.pc += 1;
ii. On line 668,
self.clock += 1;
alu_u32/src/bitwise/mod.rs
:a. In
Instruction<M>::execute
forXor32Instruction
:i. The addition on line 145 (computing
read_addr_1
)ii. The addition on line 146 (computing
write_addr
)iii. The addition on line 153 (computing
read_addr_2
)b. In
Instruction<M>::execute
forAnd32Instruction
:i. The addition on line 181 (computing
read_addr_1
)ii. The addition on line 182 (computing
write_addr
)iii. The addition on line 190 (computing
read_addr_2
)c. In
Instruction<M>::execute
forOr32Instruction
:i. The addition on line 217 (computing
read_addr_1
)ii. The addition on line 218 (computing
write_addr
)iii. The addition on line 225 (computing
read_addr_2
)alu_u32/src/div/mod.rs
, inInstruction<M>::execute
forDiv32Instruction
:a. The addition on line 77 (computing
read_addr_1
)b. The addition on line 78 (computing
write_addr
)c. The addition on line 85 (computing
read_addr_2
)alu_u32/src/lt/mod.rs
, inInstruction<M>::execute
forLt32Instruction
:a. The addition on line 128 (computing
read_addr_1
)b. The addition on line 129 (computing
write_addr
)c. The addition on line 136 (computing
read_addr_2
)alu_u32/src/mul/mod.rs
, inInstruction::execute
forMul32Instruction
:a. The addition on line 123 (computing
read_addr_1
)b. The addition on line 124 (computing
write_addr
)c. The addition on line 131 (computing
read_addr_2
)d. The multiplication on line 135 (computing
a
)alu_u32/src/shift/mod.rs
:a. In
Instruction<M>::execute
forShl32Instruction
:i. The addition on line 172 (computing
read_addr_1
)ii. The addition on line 172 (computing
write_addr
)iii. The addition on line 180 (computing
read_addr_2
)b. In
Instruction<M>::execute
forShr32Instruction
:i. The addition on line 216 (computing
read_addr_1
)ii. The addition on line 217 (computing
write_addr
)iii. The addition on line 224 (computing
read_addr_2
)alu_u32/src/sub/mod.rs
, inInstruction<M>::execute
forSub32Instruction
:a. The addition on line 137 (computing
read_addr_1
)b. The addition on line 138 (computing
write_addr
)c. The addition on line 145 (computing
read_addr_2
)d. The subtraction on line 149 (computing
a
)native_field/src/lib.rs
:a. In
Instruction<M>::execute
forAddInstruction
:i. The addition on line 157 (computing
read_addr_1
)ii. The addition on line 158 (computing
write_addr
)iii. The addition on line 165 (computing
read_addr_2
)b. In
Instruction<M>::execute
forSubInstruction
:i. The addition on line 197 (computing
read_addr_1
)ii. The addition on line 198 (computing
write_addr
)iii. The addition on line 205 (computing
read_addr_2
)c. In
Instruction<M>::execute
forMulInstruction
:i. The addition on line 237 (computing
read_addr_1
)ii. The addition on line 238 (computing
write_addr
)iii. The addition on line 245 (computing
read_addr_2
)output/src/lib.rs
:a. In
Chip<M>::generate_trace
forOutputChip
:i. The subtraction on line 66 (computing
cols.diff
)b. In
Instruction<M>::execute
forWriteInstruction
:i. The addition on line 149 (computing
read_addr_1
)The text was updated successfully, but these errors were encountered: