about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-04-14 00:03:54 -0700
committerbors <bors@rust-lang.org>2013-04-14 00:03:54 -0700
commit79d4f1402e9abc7a8910a5d81dbb4d19c8c1b2b6 (patch)
tree6e3449035b7de2ef3de5d490c9b1a22fdc49dc69
parent8c2e5cceee6603030a1a96f92be3676d388562e3 (diff)
parent685c4d0b76b26439905b0676069818e757913319 (diff)
downloadrust-79d4f1402e9abc7a8910a5d81dbb4d19c8c1b2b6.tar.gz
rust-79d4f1402e9abc7a8910a5d81dbb4d19c8c1b2b6.zip
auto merge of #5779 : crabtw/rust/x86_64_abi, r=sanxiyn
This fixes #5754.
-rw-r--r--src/librustc/middle/trans/cabi_x86_64.rs4
-rw-r--r--src/rt/rust_builtin.cpp10
-rw-r--r--src/rt/rustrt.def.in1
-rw-r--r--src/test/run-pass/issue-5754.rs20
4 files changed, 33 insertions, 2 deletions
diff --git a/src/librustc/middle/trans/cabi_x86_64.rs b/src/librustc/middle/trans/cabi_x86_64.rs
index 0e4bf5ce574..fa85588cb0f 100644
--- a/src/librustc/middle/trans/cabi_x86_64.rs
+++ b/src/librustc/middle/trans/cabi_x86_64.rs
@@ -256,10 +256,10 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] {
                         cls[i] = sse_int_class;
                     } else if is_sse(cls[i]) {
                         i += 1;
-                        while cls[i] == sseup_class { i += 1u; }
+                        while i != e && cls[i] == sseup_class { i += 1u; }
                     } else if cls[i] == x87_class {
                         i += 1;
-                        while cls[i] == x87up_class { i += 1u; }
+                        while i != e && cls[i] == x87up_class { i += 1u; }
                     } else {
                         i += 1;
                     }
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index f586e05772b..3c6cc9d9245 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -866,6 +866,16 @@ rust_dbg_extern_identity_TwoU64s(TwoU64s u) {
     return u;
 }
 
+struct TwoDoubles {
+    double one;
+    double two;
+};
+
+extern "C" CDECL TwoDoubles
+rust_dbg_extern_identity_TwoDoubles(TwoDoubles u) {
+    return u;
+}
+
 extern "C" CDECL double
 rust_dbg_extern_identity_double(double u) {
     return u;
diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in
index 59fd8991622..73dbe661d3f 100644
--- a/src/rt/rustrt.def.in
+++ b/src/rt/rustrt.def.in
@@ -199,6 +199,7 @@ rust_opendir
 rust_dbg_extern_identity_u32
 rust_dbg_extern_identity_u64
 rust_dbg_extern_identity_TwoU64s
+rust_dbg_extern_identity_TwoDoubles
 rust_dbg_extern_identity_double
 rust_dbg_extern_identity_u8
 rust_get_rt_env
diff --git a/src/test/run-pass/issue-5754.rs b/src/test/run-pass/issue-5754.rs
new file mode 100644
index 00000000000..c440fe525ee
--- /dev/null
+++ b/src/test/run-pass/issue-5754.rs
@@ -0,0 +1,20 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct TwoDoubles {
+    r: float,
+    i: float
+}
+
+extern "C" {
+    fn rust_dbg_extern_identity_TwoDoubles(arg1: TwoDoubles) -> TwoDoubles;
+}
+
+pub fn main() {}