]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Add test from issue 1446
authorOwen Avery <powerboat9.gamer@gmail.com>
Wed, 3 May 2023 00:21:42 +0000 (20:21 -0400)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:34:16 +0000 (18:34 +0100)
gcc/testsuite/ChangeLog:

* rust/compile/issue-1446.rs: New test.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
gcc/testsuite/rust/compile/issue-1446.rs [new file with mode: 0644]

diff --git a/gcc/testsuite/rust/compile/issue-1446.rs b/gcc/testsuite/rust/compile/issue-1446.rs
new file mode 100644 (file)
index 0000000..8bfa42b
--- /dev/null
@@ -0,0 +1,10 @@
+pub fn to_le(this: u32) -> u32 {
+    #[cfg(target_endian = "little")]
+    {
+        this
+    }
+    #[cfg(not(target_endian = "little"))]
+    {
+        this.swap_bytes()
+    }
+}