mrk-its / rust-mos

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
55 stars 7 forks source link

Compilation hangs on 64-bit `checked_mul` call #10

Closed mrk-its closed 1 year ago

mrk-its commented 1 year ago

Compilation of following code (cargo build) hangs:

src/main.rs:


#![no_std]
#![feature(start)]
#![allow(unused_variables)]

use core::panic::PanicInfo;
use ufmt_stdio::*;

#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
    loop {}
}

#[start]
fn main(_argc: isize, _argv: *const *const u8) -> isize {
    let mut result: u64 = 10;
    for _ in 0..3 {
        result = result.checked_mul(10).unwrap_or(0);
        println!("result: {}", result);
    }
    0
}

.cargo/config.toml:

[build]
target = "mos-sim-none"

[target.mos-sim-none]
runner = ["mos-sim", "--cycles"]

[unstable]
build-std = ["core"]

Cargo.toml:

[package]
name = "hang"
version = "0.1.0"
edition = "2021"

[profile.dev]
lto = true
opt-level = "s"
panic = "abort"
overflow-checks = true

[dependencies]
ufmt-stdio = "0"
mrk-its commented 1 year ago

llvm-ir.zip

mrk-its commented 1 year ago

https://github.com/llvm-mos/llvm-mos/issues/235