Testcase gcc.dg/memcpy-1.c fails on AVR target. Failure occurs because the return value is not simplified to avoid memcpy. This test works on i686 and I can't see why same optimization should not apply to AVR
Test is: /* { dg-do compile } */ /* { dg-options "-O2 -fdump-tree-optimized" } */ /* { dg-final { scan-tree-dump-times "nasty_local" 0 "optimized" } } */ /* { dg-final { cleanup-tree-dump "optimized" } } */ struct a {int a,b,c;} a; int test(struct a a) { struct a nasty_local; __builtin_memcpy (&nasty_local,&a, sizeof(a)); return nasty_local.a; } On i686 we get: ;; Function test (test) Analyzing Edge Insertions. test (struct a a) { <bb 2>: return a.a; } BUT on AVR we get: ;; Function test (test) Analyzing Edge Insertions. test (struct a a) { struct a nasty_local; <bb 2>: nasty_local = a; return nasty_local.a; } I have confirmed the final AVR code is suboptimal. -- Summary: Failed optimisation of return of struct argment in memcpy-1.c Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: hutchinsonandy at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: avr-unknown-none http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36598