aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/pr51721.c
blob: b39adfb50c2a27f296fc1c21d014590d9de76348 (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
30
31
/* PR tree-optimization/51721 */
/* { dg-do compile } */
/* { dg-options "-O2 -Warray-bounds" } */

static int a[10], b[10], c[10], d[10];

unsigned int
f (unsigned int v)
{
  return v == 17 ? 11 : v;
}

unsigned int
g (unsigned int v)
{
  return v == 17 ? 17 : v;
}

void
t (unsigned int s)
{
  if (s >> 1 == 0)
    {
      a[f (s)] = 0;	/* { dg-bogus "array subscript is above array bounds" } */
      a[f (s)] = 0;	/* { dg-bogus "array subscript is above array bounds" } */
      b[f (s)] = 0;	/* { dg-bogus "array subscript is above array bounds" } */
      c[g (s)] = 0;	/* { dg-bogus "array subscript is above array bounds" } */
      c[g (s)] = 0;	/* { dg-bogus "array subscript is above array bounds" } */
      d[f (s)] = 0;	/* { dg-bogus "array subscript is above array bounds" } */
    }
}