https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71106
Bug ID: 71106 Summary: MIPS: Unaligned load/store instructions are not used to access a variable with an aligned attribute Product: gcc Version: 6.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: andrew.bennett at imgtec dot com Target Milestone: --- Hi, Currently if we build the following example for MIPS: int a __attribute__((aligned(1))); void foo (void) { a = 0; } Using the following command line options: -mips32r2 -O2 -mno-gpopt It generates a sw instruction to store the value of 0 to the variable a, when it should be using a swl/swr instruction sequence because the value of the aligned attribute is less than the natural alignment of the int type. .ent foo .type foo, @function foo: .frame $sp,0,$31 # vars= 0, regs= 0/0, args= 0, gp= 0 .mask 0x00000000,0 .fmask 0x00000000,0 .set noreorder .set nomacro lui $2,%hi(a) jr $31 sw $0,%lo(a)($2) .set macro .set reorder .end foo .size foo, .-foo .comm a,4,1