summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/guality/nrv-1.c
blob: 6e70050ec4d2c9af9977d91b994febe11cd3b372 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* { dg-do run } */
/* { dg-options "-g -fno-tree-sra" } */

void abort (void);

struct A
{
  int i[100];
};

struct A a1, a3;

__attribute__((noinline)) struct A
f ()
{
  struct A a2;
  a2.i[0] = 42;
  if (a3.i[0] != 0)
    abort ();
  a2.i[4] = 7;	/* { dg-final { gdb-test 20 "a2.i\[0\]" "42" } } */
  return a2;
}

int
main ()
{
  a1 = f ();
  return 0;
}