https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124748
--- Comment #8 from Adam Panchártek <adam.panchartek at gmail dot com> ---
Thank you for the clarification, that is very helpful.
We have identified two distinct cases:
Binary buffer parsing – We are casting raw byte buffers directly to double
pointers like double value = *(double*)&buffer[offset]. We understand this is
undefined behavior and the correct fix here is to use memcpy. We will address
this in our code.
Packed structures – You say these should work correctly, as the compiler
recognizes the alignment of 1 and generates safe code. We will verify this with
the latest toolchain using a simple test case:
struct {
uint8_t my_u8;
uint32_t my_u32;
double my_double;
} __attribute__((packed)) test;
test.my_u8 = 0x12;
test.my_u32 = 0x12345678;
test.my_double = 0x1234567812345678;
We will inspect the generated assembly to confirm that LDRD/STRD is not used
for my_double, and report back with our findings.