From e948d843670e4a7b803e97e8ead65a7c121cf598 Mon Sep 17 00:00:00 2001 From: Grumme2 <agh@live.se> Date: Thu, 20 Feb 2020 14:05:01 +0100 Subject: [PATCH] bare0_2 --- examples/bare0.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/bare0.rs b/examples/bare0.rs index 94a5e1d..4e65073 100644 --- a/examples/bare0.rs +++ b/examples/bare0.rs @@ -26,8 +26,8 @@ extern crate panic_semihosting; use cortex_m_rt::entry; // a constant (cannot be changed at run-time) -const X_INIT: u32 = 10; -//const X_INIT: u32 = core::u32::MAX; +//const X_INIT: u32 = 10; +const X_INIT: u32 = core::u32::MAX; // global mutable variables (changed using unsafe code) static mut X: u32 = X_INIT; @@ -85,6 +85,8 @@ fn main() -> ! { // (Hint, look under OUTPUT/Adopter Output to see the `openocd` output.) // // ** your answer here ** +// First it says that the local x gets optimized out then it panics +// "panicked at 'attempt to add with overflow', examples/bare0.rs:42:9" // // Commit your answers (bare0_2) // -- GitLab