Extracted from http://embed.cs.utah.edu/embarrassing/dec_09/harvest/gcc-head_llvm-gcc-head/
I've seen this in multiple examples both compared to llvm and icc. The other compilers merge adjacent stores to structures in memory, gcc doesn't. Simple toy example: struct foo { short a; char c; char d; int x; }; void f(struct foo *f) { f->a = 1; f->c = 0; f->d = 1; f->x = 0; } generates with -O2 -S -mtune=generic 4.5.0 20091219 movw $1, (%rdi) movb $0, 2(%rdi) movb $1, 3(%rdi) movl $0, 4(%rdi) but since everything is aligned it could be just (from icc) movl $16777217, (%rdi) #11.2 movl $0, 4(%rdi) #14.2 (possibly even a single movq, exploiting CPUs with very fast misalignment support like Nehalem) -- Summary: no store merging for structure stores Product: gcc Version: unknown Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: rtl-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: andi-gcc at firstfloor dot org GCC host triplet: x86_64-linux GCC target triplet: x86_64-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42594