On 2023-11-13 21:50, Jeffrey Walton wrote:
[1] also says: "By default, this boundary is aligned so that the object can
hold any type of data." Needs to be investigated in more depth...
...
When using the default toolchain settings, -xmemalign=8s is used,
which causes the toolchain to use the optimized loads. I think that is
what is generating the UBsan finding "runtime error: member access
within misaligned address ... which requires 8 byte alignment."
What is the value of DEFAULT_ALIGNMENT on this platform? It sounds like
it should be at least 8. If not, please investigate why not.
One possibility is that part of the application is being compiled with
the cc (or cc with its default setting -xmemalign=8s), whereas other
parts are being compiled with gcc or with clang or with some other cc
-xmemalign settings. That's a no-no. Changing -xmemalign changes the
ABI, so one needs to be consistent about -xmemalign.
On this platform, in general one cannot mix .o files compiled with plain
cc, with files compiled with gcc or clang. Which is of course a pain.