about summary refs log tree commit diff
path: root/src/rt
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-04-26 17:49:38 -0700
committerBrian Anderson <banderson@mozilla.com>2012-04-26 18:30:58 -0700
commitbbc4a74dc685a570ebdf53849e8cc2220ed1d586 (patch)
tree8faa33cdd2944106cdd6d9b94ca8dac962a9833f /src/rt
parent8e15640adacd1f0cab8617d62f445024915e5214 (diff)
rt: Fix shape alignment of 64-bit ints on x86. Issue #2303
Diffstat (limited to 'src/rt')
-rw-r--r--src/rt/rust_shape.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/rt/rust_shape.h b/src/rt/rust_shape.h
index a181a881457..64b1cd2deb8 100644
--- a/src/rt/rust_shape.h
+++ b/src/rt/rust_shape.h
@@ -123,6 +123,18 @@ rust_alignof<double>() {
     return 4;
 }
 
+// Issue #2303
+// On 32-bit x86 the alignment of 64-bit ints in structures is 4 bytes
+// Which is different from the preferred 8-byte alignment reported
+// by __alignof__ (at least on gcc).
+#ifdef __i386__
+template<>
+inline size_t
+rust_alignof<uint64_t>() {
+    return 4;
+}
+#endif
+
 
 // Utility classes