view gcc/testsuite/gcc.dg/nrv2.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* Test that the tree_nrv pass works by making sure that we don't generate
   a memcpy.  Throw in a bit of control flow to make its job a bit harder.  */

/* { dg-options "-O" } */

struct A { int i[100]; };

int b;

struct A f ()
{
  struct A a;
  if (b)
    {
      a.i[0] = 42;
      return a;
    }
  else
    {
      a.i[42] = 1;
      return a;
    }
}

/* { dg-final { scan-assembler-not "memcpy" } } */