https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65529
Bug ID: 65529 Summary: [5 Regression][SH] gcc.dg/pr29215.c failing Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: olegendo at gcc dot gnu.org Target: sh*-*-* The test case for PR 29215 started to fail on SH: FAIL: gcc.dg/pr29215.c scan-tree-dump-not gimple "memcpy" Looking at the assembly output of the test case, the memcpy is optimized away, albeit at a later stage during compilation through builtin expansion. One option would be to scan the final assembly output for 'memcpy' symbols: Index: gcc/testsuite/gcc.dg/pr29215.c =================================================================== --- gcc/testsuite/gcc.dg/pr29215.c (revision 221603) +++ gcc/testsuite/gcc.dg/pr29215.c (working copy) @@ -1,6 +1,6 @@ /* PR middle-end/29215 */ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-gimple" } */ +/* { dg-options "-O2" } */ char buf[5 * sizeof (int) + 1] __attribute__((aligned (__alignof__ (int)))); @@ -29,5 +29,4 @@ return 0; } -/* { dg-final { scan-tree-dump-not "memcpy" "gimple" } } */ -/* { dg-final { cleanup-tree-dump "gimple" } } */ +/* { dg-final { scan-assembler-not "memcpy" } } */ However, PR 29215 was specifically about optimizing away memcpy at the tree level, so I'm not sure whether this is an appropriate "fix". Something else must have changed to trigger the new failure ... In the gimple dump, the foo is: foo (int arg1, int arg2, int arg3, int arg4, int arg5) { unsigned int D.1477; void * D.1478; void * D.1479; void * D.1480; void * D.1481; D.1477 = MEM[(char * {ref-all})&arg1]; MEM[(char * {ref-all})&buf] = D.1477; D.1478 = &buf + 4; __builtin_memcpy (D.1478, &arg2, 4); D.1479 = &buf + 8; __builtin_memcpy (D.1479, &arg3, 4); D.1480 = &buf + 12; __builtin_memcpy (D.1480, &arg4, 4); D.1481 = &buf + 16; __builtin_memcpy (D.1481, &arg5, 4); } On 4.9 it looked like this: foo (int arg1, int arg2, int arg3, int arg4, int arg5) { int D.1387; int D.1388; int D.1389; int D.1390; int D.1391; D.1387 = MEM[(char * {ref-all})&arg1]; MEM[(char * {ref-all})&buf] = D.1387; D.1388 = MEM[(char * {ref-all})&arg2]; MEM[(char * {ref-all})&buf + 4B] = D.1388; D.1389 = MEM[(char * {ref-all})&arg3]; MEM[(char * {ref-all})&buf + 8B] = D.1389; D.1390 = MEM[(char * {ref-all})&arg4]; MEM[(char * {ref-all})&buf + 12B] = D.1390; D.1391 = MEM[(char * {ref-all})&arg5]; MEM[(char * {ref-all})&buf + 16B] = D.1391; }