aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorOwen Avery <powerboat9.gamer@gmail.com>2023-05-02 20:21:42 -0400
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-16 18:34:16 +0100
commita365e3ed705caf88509acc9237cfba1bffcea797 (patch)
treea5866bb3ec9a24d20a104b6ccc6255771455fddb /gcc
parentb181ea7289b229b1e5971ccbbdd4f74dbdacefa9 (diff)
downloadgcc-a365e3ed705caf88509acc9237cfba1bffcea797.zip
gcc-a365e3ed705caf88509acc9237cfba1bffcea797.tar.gz
gcc-a365e3ed705caf88509acc9237cfba1bffcea797.tar.bz2
gccrs: Add test from issue 1446
gcc/testsuite/ChangeLog: * rust/compile/issue-1446.rs: New test. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/rust/compile/issue-1446.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/issue-1446.rs b/gcc/testsuite/rust/compile/issue-1446.rs
new file mode 100644
index 0000000..8bfa42b
--- /dev/null
+++ b/gcc/testsuite/rust/compile/issue-1446.rs
@@ -0,0 +1,10 @@
+pub fn to_le(this: u32) -> u32 {
+ #[cfg(target_endian = "little")]
+ {
+ this
+ }
+ #[cfg(not(target_endian = "little"))]
+ {
+ this.swap_bytes()
+ }
+}