summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/Wrestrict-17.c
blob: 4e7259734b2c1a580e5891f90cccacb062cbaa24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* PR tree-optimization/85826 - ICE in gimple-ssa-warn-restruct on
   a variable-length struct
   { dg-do compile }
   { dg-require-effective-target alloca }
   { dg-options "-O2 -Wall" }  */

int f (int n)
{
  typedef struct { int a[n]; } S;

  S a;
  __attribute__ ((noinline)) S g (void) { return a; }

  a.a[0] = 1;
  a.a[9] = 2;

  S b;
  b = g ();

  return b.a[0] == 1 && b.a[9] == 2;
}