Compiling: typedef struct { int foo [1000]; int savelines; } TScreen; void foo (TScreen *s) { s->savelines = 0; } with -march=i686 -O2 and -march=i686 -Os the .text size is 16 and 18 bytes, respectively.
the assembly sdiff looks like: xorl %edx, %edx < movl %esp, %ebp movl %esp, %ebp movl 8(%ebp), %eax movl 8(%ebp), %eax movl %edx, 4000(%eax) | movl $0, 4000(%eax) The patch below fixes it. *** i386.md 08 Aug 2005 16:38:37 -0700 1.652 --- i386.md 11 Aug 2005 11:27:11 -0700 *************** *** 18874,18881 **** [(match_scratch:SI 1 "r") (set (match_operand:SI 0 "memory_operand" "") (const_int 0))] ! "! optimize_size ! && ! TARGET_USE_MOV0 && TARGET_SPLIT_LONG_MOVES && get_attr_length (insn) >= ix86_cost->large_insn && peep2_regno_dead_p (0, FLAGS_REG)" --- 18874,18880 ---- [(match_scratch:SI 1 "r") (set (match_operand:SI 0 "memory_operand" "") (const_int 0))] ! "! TARGET_USE_MOV0 && TARGET_SPLIT_LONG_MOVES && get_attr_length (insn) >= ix86_cost->large_insn && peep2_regno_dead_p (0, FLAGS_REG)" -- Summary: -march=i686 -O2 generates smaller code that -march=i686 -Os Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dann at godzilla dot ics dot uci dot edu CC: gcc-bugs at gcc dot gnu dot org GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23338