From 4efe9bc12e0966455c4fd49d82138dab686f4753 Mon Sep 17 00:00:00 2001 From: rubenasplund <ruben.asplund@hotmail.com> Date: Wed, 16 Dec 2020 15:11:56 +0100 Subject: [PATCH] Exercise A --- cargo_klee_examples/examples/array.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cargo_klee_examples/examples/array.rs b/cargo_klee_examples/examples/array.rs index 9ec5e10..4222e14 100644 --- a/cargo_klee_examples/examples/array.rs +++ b/cargo_klee_examples/examples/array.rs @@ -37,7 +37,11 @@ fn main() { // Try to explain in your own words the difference and why? // (Hint, even if we don't use the result `b`, Rust do not optimize out the call, why?) // -// [your answer here] +// [There are 10 path with debug/dev mode and 2 path on release mode. +// In the debug mode/dev 8 of the paths is 8 for each loop, 1 path is for panic when index is out of range. +// The release mode is optimizing out all the loops, which means there are only two paths; one inside the loop +// and one outside. The b is not optimized out because the calculation of b can have side effects and +// code with side effects are not optimized out.] // // B) Fix the code so that you don't get an error. // (It should still compute the sum of the n first elements -- GitLab