[PATCH] CodeGen: Resize LifetimeExtendedCleanupHeader to avoid alignment issues

Justin Bogner mail at justinbogner.com
Mon Jun 22 17:26:27 PDT 2015


The LifetimeExtendedCleanupHeader is carefully fit into 32 bytes,
meaning that cleanups on the LifetimeExtendedCleanupStack are *always*
allocated at a misaligned address and cause undefined behaviour.

There are two ways to solve this - add padding after the header when
we allocated our cleanups, or just simplify the header and let it use
64 bits in the first place. I've opted for the latter, and added a
static assert to avoid the issue in the future.

This does waste some space in the 32-bit case. It wouldn't be too hard
to make the size of this struct dependent on the host machine if
that's an issue. WDYT?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ub-clang-cleanups.patch
Type: text/x-patch
Size: 1987 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150622/35bf9a23/attachment.bin>


More information about the cfe-commits mailing list