view gcc/testsuite/gcc.dg/Wrestrict-17.c @ 158:494b0b89df80 default tip

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

/* 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;
}