From ead0824f65e7000d37e298c36e7292d4539d94f8 Mon Sep 17 00:00:00 2001 From: Anton <anton.frappe@outlook.com> Date: Wed, 3 Mar 2021 16:20:07 +0100 Subject: [PATCH] bare1_6 --- examples/rtic_bare1.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/examples/rtic_bare1.rs b/examples/rtic_bare1.rs index 6a48f5d..b09d722 100644 --- a/examples/rtic_bare1.rs +++ b/examples/rtic_bare1.rs @@ -26,7 +26,7 @@ const APP: () = { // prevent optimization by read-volatile (unsafe) unsafe { - core::ptr::read_volatile(&x); + //core::ptr::read_volatile(&x); } } } @@ -355,12 +355,17 @@ const APP: () = { // // Dump the generated assembly. // -// ** your answer here ** +// 0x08000240 <+0>: push {r7, lr} +// 0x08000242 <+2>: mov r7, sp +// => 0x08000244 <+4>: bkpt 0x0000 +// 0x08000246 <+6>: bkpt 0x0000 +// 0x08000248 <+8>: b.n 0x8000244 <rtic_bare1::init+4> // // Where is the local variable stored? // What happened, and why is Rust + LLVM allowed to optimize out your code? // -// ** your answer here ** +// Since the local variable is no longer read then the compiler can +// optimize away the variable. // // Commit your answers (bare1_6) // -- GitLab