view gcc/testsuite/gcc.dg/Warray-bounds-35.c @ 158:494b0b89df80 default tip

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

/* PR tree-optimization/87072 - g++6.2.0 false warning: array subscript
   is above array bounds, with misleading line number
   { dg-do compile }
   { dg-options "-O3 -Wall" }  */

int a[10];

void f (unsigned n)
{
  for (unsigned j = 0; j < n; j++) {
     for (unsigned k = 0; k < j; k++)
       a[j] += k;                       /* { dg-bogus "\\\[-Warray-bounds]" } */
     a[j] += j;
  }
}