diff --git a/Cargo.lock b/Cargo.lock index 404fb9c6db1..85675fc40c3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -74,7 +74,7 @@ dependencies = [ [[package]] name = "gccjit" version = "1.0.0" -source = "git+https://github.com/antoyo/gccjit.rs#ff1f82584c760a8b870dc6bad9841bd090f92f80" +source = "git+https://github.com/antoyo/gccjit.rs#0b158c68bf7e46732869d90550a98e886dee8858" dependencies = [ "gccjit_sys", ] @@ -82,7 +82,7 @@ dependencies = [ [[package]] name = "gccjit_sys" version = "0.0.1" -source = "git+https://github.com/antoyo/gccjit.rs#ff1f82584c760a8b870dc6bad9841bd090f92f80" +source = "git+https://github.com/antoyo/gccjit.rs#0b158c68bf7e46732869d90550a98e886dee8858" dependencies = [ "libc", ] diff --git a/failing-ui-tests.txt b/failing-ui-tests.txt index 0711ae99a3e..8ec151f7838 100644 --- a/failing-ui-tests.txt +++ b/failing-ui-tests.txt @@ -14,7 +14,6 @@ tests/ui/sepcomp/sepcomp-fns-backwards.rs tests/ui/sepcomp/sepcomp-fns.rs tests/ui/sepcomp/sepcomp-statics.rs tests/ui/simd/intrinsic/generic-arithmetic-pass.rs -tests/ui/target-feature/missing-plusminus.rs tests/ui/asm/x86_64/may_unwind.rs tests/ui/backtrace.rs tests/ui/catch-unwind-bang.rs diff --git a/failing-ui-tests12.txt b/failing-ui-tests12.txt index 8c27bd8b8ca..0ac0a034af4 100644 --- a/failing-ui-tests12.txt +++ b/failing-ui-tests12.txt @@ -37,3 +37,4 @@ tests/ui/simd/intrinsic/generic-gather-pass.rs tests/ui/simd/issue-85915-simd-ptrs.rs tests/ui/issues/issue-68010-large-zst-consts.rs tests/ui/rust-2018/proc-macro-crate-in-paths.rs +tests/ui/target-feature/missing-plusminus.rs diff --git a/src/builder.rs b/src/builder.rs index b0feb99e3c6..04100f2ad2e 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -922,6 +922,12 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> { // require dereferencing the pointer. for index in indices { pointee_type = pointee_type.get_pointee().expect("pointee type"); + #[cfg(feature="master")] + let pointee_size = { + let size = self.cx.context.new_sizeof(pointee_type); + self.context.new_cast(None, size, index.get_type()) + }; + #[cfg(not(feature="master"))] let pointee_size = self.context.new_rvalue_from_int(index.get_type(), pointee_type.get_size() as i32); result = result + self.gcc_int_cast(*index * pointee_size, self.sizet_type); } diff --git a/src/gcc_util.rs b/src/gcc_util.rs index 18343d58c35..0514c9988e0 100644 --- a/src/gcc_util.rs +++ b/src/gcc_util.rs @@ -1,3 +1,4 @@ +#[cfg(feature="master")] use gccjit::Context; use smallvec::{smallvec, SmallVec}; @@ -202,11 +203,16 @@ fn handle_native(name: &str) -> &str { return name; } - // Get the native arch. - let context = Context::default(); - context.get_target_info().arch().unwrap() - .to_str() - .unwrap() + #[cfg(feature="master")] + { + // Get the native arch. + let context = Context::default(); + context.get_target_info().arch().unwrap() + .to_str() + .unwrap() + } + #[cfg(not(feature="master"))] + unimplemented!(); } pub fn target_cpu(sess: &Session) -> &str { diff --git a/test.sh b/test.sh index c47cf140ae4..5b7ef7ab101 100755 --- a/test.sh +++ b/test.sh @@ -220,6 +220,7 @@ changelog-seen = 2 [rust] codegen-backends = [] deny-warnings = false +verbose-tests = true [build] cargo = "$(rustup which cargo)" diff --git a/tests/run/gep.rs b/tests/run/gep.rs new file mode 100644 index 00000000000..c3d1672cff5 --- /dev/null +++ b/tests/run/gep.rs @@ -0,0 +1,10 @@ +// Compiler: +// +// Run-time: +// status: 0 + +fn main() { + let mut value = (1, 1); + let ptr = &mut value as *mut (i32, i32); + println!("{:?}", ptr.wrapping_offset(10)); +}