From bbc4a74dc685a570ebdf53849e8cc2220ed1d586 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Thu, 26 Apr 2012 17:49:38 -0700 Subject: rt: Fix shape alignment of 64-bit ints on x86. Issue #2303 --- src/rt/rust_shape.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/rt') 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() { 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() { + return 4; +} +#endif + // Utility classes -- cgit 1.4.1-3-g733a5