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

--- Comment #2 from Michael Bruck <bruck.michael at googlemail dot com> ---
(In reply to Richard Earnshaw from comment #1)
> This is a deliberate design choice.  By doing this we gain significant
> benefits from having aligned objects, which helps with data copying and
> other optimizations.
> 
> Consider, for example, the object
> 
> struct x
> {
>   char a;
>   char b;
>   char c;
>   char d;
> };
> 
> struct x A, B;
> 
> f()
> {
>   B = A;
> }
> 
> Since the objects are aligned then this function can be optimized to single
> 32-bit load and store operations that work very efficiently.
> 
> As you've noticed, it is possible to force the alignment down to the
> architectural minimums by annotations, but for most users it makes little
> difference and the defaults are preferable.

"for most users"

Maybe I should have specified -mcortex-m0 on the command line to illustrate the
point. For most Cortex-M0 users with 16 kB this 300% memory waste is a bad
trade-off.

Can you implement a command line option to deactivate this behavior?

Your reply did not address b) and c), should I open a separate bug to discuss
these?

Reply via email to