https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124748

--- Comment #5 from Adam Panchártek <adam.panchartek at gmail dot com> ---
I would like to bring up another real-world use case that further justifies
this request.
In small embedded systems, RAM and Flash are extremely limited resources. A
common pattern is to store arrays of packed structs, where the
__attribute__((packed)) is not used to violate alignment rules intentionally,
but to eliminate padding bytes and keep the memory footprint as small as
possible. Removing packed from such structures would increase their size due to
padding, which on arrays of hundreds or thousands of records has a significant
and often unacceptable impact on RAM and Flash usage.
In this scenario, the -munaligned-double-access option provided a clean and
surgical solution: keep the structs packed for memory efficiency, and let the
compiler handle the unaligned double access safely by replacing LDRD/STRD with
pairs of LDR/STR — without touching the rest of the codebase or impacting
performance of other modules.
We believe this is a legitimate and common embedded use case, not a design flaw
in our code.

Reply via email to