Closed
Description
export fn square(num: u8) u8 {
//while(true){} // would generate loop
return eternity(123);
}
pub fn eternity(bla:u8) u8 {
while(true)// is optimized away completely
{}
}
See asm output on goldbold.
As you said during live coding, it seems like the eternal loop is considered to have no side effects and is thus removed.
Expected behaviour would be to refuse compilation
- as there is no return of an u8
- as in case of
eternity
being declared as returningvoid
, an implicitreturn;
at the end of the function cannot be reached