[cfe-dev] -fsanitize=undefined and alignment on x86_64

Tim Northover t.p.northover at gmail.com
Fri Jan 18 08:17:21 PST 2013


>> sanitize=undefined is giving me an error message about unaligned access to
>> a size_t.  It's in a packed structure, and indeed is not 8 byte aligned
>> (although it is 4 byte aligned.)
>
> In short: because the C++ standard says so. -fsanitize=undefined is designed
> to catch programs that have undefined behavior according to the C++
> standard.

Surely the standard doesn't say anything about packed structures? If
Clang supports them I'd expect accesses to be lowered to ones which
the target supports (based on the DataLayout, perhaps amongst other
things).

Tim.



More information about the cfe-dev mailing list