diff options
-rw-r--r-- | README.md | 9 | ||||
-rw-r--r-- | gcc/testsuite/rust/compile/issue-1237.rs | 23 |
2 files changed, 32 insertions, 0 deletions
@@ -18,6 +18,15 @@ Now that the language is stable, it is an excellent time to create alternative c the project are keen “Rustaceans” with a desire to give back to the Rust community and to learn what GCC is capable of when it comes to a modern language. +## Build Farm Status + +- [Fedora X86_64](https://builder.sourceware.org/buildbot/#/builders/gccrust-fedora-x86_64) [](https://builder.sourceware.org/buildbot/#/builders/gccrust-fedora-x86_64) +- [Debian i386](https://builder.sourceware.org/buildbot/#/builders/gccrust-debian-i386) [](https://builder.sourceware.org/buildbot/#/builders/gccrust-debian-i386) +- [Fedora s390x](https://builder.sourceware.org/buildbot/#/builders/gccrust-fedora-s390x) [](https://builder.sourceware.org/buildbot/#/builders/gccrust-fedora-s390x) +- [Debian ppc64](https://builder.sourceware.org/buildbot/#/builders/gccrust-debian-ppc64) [](https://builder.sourceware.org/buildbot/#/builders/gccrust-debian-ppc64) +- [Fedora ppc64le](https://builder.sourceware.org/buildbot/#/builders/gccrust-fedora-ppc64le) [](https://builder.sourceware.org/buildbot/#/builders/gccrust-fedora-ppc64le) + ## FAQ Please find the answers to frequently asked questions over on: https://github.com/Rust-GCC/gccrs/wiki/Frequently-Asked-Questions diff --git a/gcc/testsuite/rust/compile/issue-1237.rs b/gcc/testsuite/rust/compile/issue-1237.rs new file mode 100644 index 0000000..542be89 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-1237.rs @@ -0,0 +1,23 @@ +// { dg-additional-options "-w" } +mod intrinsics { + extern "rust-intrinsic" { + pub fn offset<T>(ptr: *const T, count: isize) -> *const T; + } +} + +impl<T> *const T { + pub unsafe fn offset(self, count: isize) -> *const T { + unsafe { intrinsics::offset(self, count) } + } +} + +impl<T> [T] { + pub unsafe fn get_unchecked(&self, index: usize) -> &T { + unsafe { &*(self as *const [T] as *const T).offset(index as isize) } + } +} + +#[inline] +unsafe fn u8to64_le(buf: &[u8], start: usize, len: usize) -> u64 { + (unsafe { *buf.get_unchecked(start) } as u64) +} |