Description
I've run into an issue with code that uses interrupts on AVR. I'm not sure if this applies to any other platform.
This issue has same behavior as #75504 but It can't resolved after update compiler to current nightly version.
This issue reproduce on everything nightly rust compiler with AVR target support (I trying to compile it every nightly compiler updates).
I create minimal reproduce project for this issue - https://github.com/no111u3/m328p_robo_rust. Than I change optimization flags to size optimization level opt-level="z"
or opt-level="s"
upper code doesn't work correctly, there has two options:
- for release build there is broken in interrupt handler code
- for debug build there is broken fully, code run stopped and mcu looks halted.
I run upper code on two different mcu's that I have: on Atmega48 and Atmega328p, if we use same flags we have same behavior for run. For optimization level 2 I can use huge code in interrupt such as - https://github.com/no111u3/m48_robo_rust/blob/master/examples/dynamic_indication.rs#L119 but If I use z
or s
optimization interrupt works only for short code such as - https://github.com/no111u3/m48_robo_rust/blob/master/examples/pwm_int.rs#L39