http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53417
Bug #: 53417 Summary: multiple assignments can be optimized Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: rtl-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: daniel.marjam...@gmail.com Hello! It seems to me that assignments can be optimised more. Example code: struct X { char a; char b; char c; char d; }; void dummy(struct X *x1); void f() { struct X x = {0,0,0,0}; dummy(&x); } I compile that and look at the assembly code: gcc -c -O2 test1.c objdump -d test1.o In the assembly output the struct is initialized using 4 movb instructions. I wonder if there can't be an optimizer pass that replace these 4 movb instructions with a single movl instruction. I assume that would be faster.