From 31534259fcb759e5b113ef79ca0c909f619a13ff Mon Sep 17 00:00:00 2001 From: JoanVC Date: Sun, 8 Sep 2024 12:07:22 +0200 Subject: [PATCH] [#3141] Unit test for 32-bit machines gcc/testsuite/ChangeLog: * rust/compile/issue-3141.rs: Fix for 32-bit machines. Signed-off-by: Joan Vilardaga --- gcc/testsuite/rust/compile/issue-3141.rs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/gcc/testsuite/rust/compile/issue-3141.rs b/gcc/testsuite/rust/compile/issue-3141.rs index 102b60b3eac..3e9bb125b56 100644 --- a/gcc/testsuite/rust/compile/issue-3141.rs +++ b/gcc/testsuite/rust/compile/issue-3141.rs @@ -32,11 +32,20 @@ fn main() { let _u128_max: u128 = 340282366920938463463374607431768211455; // isize and usize - let _isize_min: isize = -9223372036854775808; - let _isize_max: isize = 9223372036854775807; - - let _usize_min: usize = 0; - let _usize_max: usize = 18446744073709551615; + #[cfg(target_pointer_width = "64")] + { + let _isize_min: isize = 9223372036854775807; + let _isize_max: isize = -9223372036854775808; + let _usize_min: usize = 0; + let _usize_max: usize = 18446744073709551615; + } + #[cfg(target_pointer_width = "32")] + { + let _isize_min: isize = 2147483647; + let _isize_max: isize = -2147483648; + let _usize_min: usize = 0; + let _usize_max: usize = 4294967295; + } // Floating point let _f32_min: f32 = -3.40282347E+38f32;