diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-02-08 08:19:48 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-08 08:19:48 -0800 |
commit | 041ee54ca264c132a882ae95e518382ede2e7a74 (patch) | |
tree | 0bc96ae0ec4cb941c6e2050a166c040060ca8144 /src/codegen/struct_layout.rs | |
parent | ddfa1e049917ad1caed834ebaf9fcfd1636dbfb9 (diff) | |
parent | e08072a1c9343c9c513e059a8a31ee2d1af129a9 (diff) |
Auto merge of #495 - flier:fix-493, r=emilio
check layout align before padding bytes
Fix issue #493 again :S
Still finding way to reproduce it
Diffstat (limited to 'src/codegen/struct_layout.rs')
-rw-r--r-- | src/codegen/struct_layout.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/codegen/struct_layout.rs b/src/codegen/struct_layout.rs index 98640570..f8a88bc2 100644 --- a/src/codegen/struct_layout.rs +++ b/src/codegen/struct_layout.rs @@ -89,9 +89,12 @@ impl<'a, 'ctx> StructLayoutTracker<'a, 'ctx> { Some(offset) if offset / 8 > self.latest_offset => { (offset / 8 - self.latest_offset, true) } - _ => { + _ if field_layout.align != 0 => { (self.padding_bytes(field_layout), (self.latest_offset % field_layout.align) != 0) } + _ => { + (0, false) + } }; self.latest_offset += padding_bytes; |