forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 38
Closed
Description
I tried this code (repo: esp-spinlock-repro):
fn main() -> anyhow::Result<()> {
esp_idf_sys::link_patches();
esp_idf_hal::task::critical_section::link();
esp_idf_svc::timer::embassy_time::driver::link();
esp_idf_svc::timer::embassy_time::queue::link();
esp_idf_svc::log::EspLogger::initialize_default();
let executor = esp_idf_hal::task::executor::EspExecutor::<4, _>::new();
let task = executor.spawn_local(async {
let mut counter = 0.0f64;
loop {
log::info!("counter at {counter}");
embassy_time::Timer::after(embassy_time::Duration::from_millis(10)).await;
counter += 1.0;
}
})?;
executor.run_tasks(|| true, [task]);
Ok(())
}
When I'm running code I've compiled with "fat" LTO, on 1.64.0.0 or 1.65.0.0, with the xtensa-esp32s3-espidf
target on my ESP32S3, regardless of the esp-idf
branch, my code hangs indefinitely after 256 iteratiots:
I (314) esp_spinlock_repro: counter at 0
I (324) esp_spinlock_repro: counter at 1
I (334) esp_spinlock_repro: counter at 2
I (344) esp_spinlock_repro: counter at 3
...
I (2914) esp_spinlock_repro: counter at 252
I (2924) esp_spinlock_repro: counter at 253
I (2934) esp_spinlock_repro: counter at 254
I (2944) esp_spinlock_repro: counter at 255
If I disable LTO or move to "thin" LTO, the code keeps chugging along with no end in sight (what I expect to see).
Meta
rustc --version --verbose
:
rustc 1.65.0-nightly (bf1b78e4a 2022-11-02)
binary: rustc
commit-hash: bf1b78e4a60871d6fed85f288274db7cdbd82912
commit-date: 2022-11-02
host: x86_64-unknown-linux-gnu
release: 1.65.0-nightly
LLVM version: 15.0.0
Metadata
Metadata
Assignees
Labels
No labels