diff options
| author | Luqman Aden <laden@csclub.uwaterloo.ca> | 2013-02-13 05:28:24 -0500 |
|---|---|---|
| committer | Luqman Aden <laden@csclub.uwaterloo.ca> | 2013-02-13 15:41:38 -0500 |
| commit | c22d0af14c621a847e71dac7fe0e7fe19bf851a1 (patch) | |
| tree | 8f4fa34f1c04b6a9d3c8a667def79f8f78611f8c | |
| parent | d67e144f685783503c1406cb4f28ea19d91d1fec (diff) | |
rt: take into account alignment for debug_opaque. Closes #2667
| -rw-r--r-- | src/rt/rust_builtin.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index 22ebc52edf0..a8e1e7a0be4 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -241,10 +241,13 @@ debug_opaque(type_desc *t, uint8_t *front) { rust_task *task = rust_get_current_task(); LOG(task, stdlib, "debug_opaque"); debug_tydesc_helper(t); - // FIXME (#2667) may want to actually account for alignment. - // `front` may not indeed be the front byte of the passed-in - // argument. for (uintptr_t i = 0; i < t->size; ++front, ++i) { + + // Account for alignment. `front` may not indeed be the + // front byte of the passed-in argument + if (((uintptr_t)front % t->align) != 0) + front = (uint8_t *)align_to((uintptr_t)front, (size_t)t->align); + LOG(task, stdlib, " byte %" PRIdPTR ": 0x%" PRIx8, i, *front); } } |
