gcc/testsuite/rust/execute/torture/loop-condition-eval.rs
raw| 1 | // { dg-output "1\r*\n" } |
| 2 | pub fn test() -> u64 { |
| 3 | let mut n = 113383; // #20 in https://oeis.org/A006884 |
| 4 | while n != 1 { |
| 5 | n = if n % 2 == 0 { n / 2 } else { 3 * n + 1 }; |
| 6 | } |
| 7 | n |
| 8 | } |
| 9 | |
| 10 | pub fn test_1() -> u64 { |
| 11 | test() |
| 12 | } |
| 13 | |
| 14 | extern "C" { |
| 15 | fn printf(fmt: *const i8, ...); |
| 16 | } |
| 17 | |
| 18 | fn main() -> i32 { |
| 19 | unsafe { printf("%lu\n" as *const str as *const i8, test_1()) } |
| 20 | 0 |
| 21 | } |