For the following code, typedef struct { char c[11111]; } s;
void f(s *a, s *b){ *a = *b; } compiling for ARM, with -Os, mainline GCC generates the following: str lr, [sp, #-4]! ldr r2, .L2 bl memcpy ldr pc, [sp], #4 .L3: .align 2 .L2: .word 11112 GCC 3.4.6 generates a tail call: ldr r2, .L2 @ lr needed for prologue b memcpy .L3: .align 2 .L2: .word 11112 The first release of GCC to regress in this way was 4.0.0. Here is a backtrace from emit_block_move_hints. #0 emit_block_move_hints (x=0x2ba56160cae0, y=0x2ba56160cb20, size=0x2ba5615cedc0, method=BLOCK_OP_NORMAL, expected_align=0, expected_size=-1) at ../../gcc/expr.c:1163 #1 0x0000000000656f33 in emit_block_move (x=0x2ba56160cae0, y=0x2ba56160cb20, size=0x2ba5615cedc0, method=BLOCK_OP_NORMAL) at ../../gcc/expr.c:1233 #2 0x000000000066076d in store_expr (exp=0x2ba5610fa0c0, target=0x2ba56160cae0, call_param_p=0, nontemporal=0 '\0') at ../../gcc/expr.c:4779 #3 0x000000000065ee57 in expand_assignment (to=0x2ba5610fa080, from=0x2ba5610fa0c0, nontemporal=0 '\0') at ../../gcc/expr.c:4428 Is there any way store_expr() could pass BLOCK_OP_TAILCALL to emit_block_move()? If not, then can this be transformed into a tail call later? -- Summary: memcpy not tail called if it's a struct assignment Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: TabonyEE at austin dot rr dot com GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: arm-elf http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41455