about summary refs log tree commit diff
path: root/src/rustllvm/ExecutionEngineWrapper.cpp
diff options
context:
space:
mode:
authorBjörn Steinbrink <bsteinbr@gmail.com>2015-04-15 20:14:54 +0200
committerBjörn Steinbrink <bsteinbr@gmail.com>2015-04-18 18:32:14 +0200
commit78745a4afe90fc5f24b9fa3af6a31551859419f8 (patch)
tree48bd308ab7f04a46b62217c3f0067cc10e07cd8d /src/rustllvm/ExecutionEngineWrapper.cpp
parentfcf637b19f1a94dcf1748b8b29fca100f150eb0a (diff)
downloadrust-78745a4afe90fc5f24b9fa3af6a31551859419f8.tar.gz
rust-78745a4afe90fc5f24b9fa3af6a31551859419f8.zip
Emit correct alignment information for loads/store of small aggregates
Loading from and storing to small aggregates happens by casting the
aggregate pointer to an appropriately sized integer pointer to avoid
the usage of first class aggregates which would lead to less optimized
code.

But this means that, for example, a tuple of type (i16, i16) will be
loading through an i32 pointer and because we currently don't provide
alignment information LLVM assumes that the load should use the ABI
alignment for i32 which would usually be 4 byte alignment. But the
alignment requirement for the (i16, i16) tuple will usually be just 2
bytes, so we're overestimating alignment, which invokes undefined
behaviour.

Therefore we must emit appropriate alignment information for
stores/loads through such casted pointers.

Fixes #23431
Diffstat (limited to 'src/rustllvm/ExecutionEngineWrapper.cpp')
0 files changed, 0 insertions, 0 deletions