summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/Warray-bounds-21.c
blob: 759944fc00c88f32469dd4c72ab2030cb71f65cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* { dg-do compile } */
/* { dg-options "-O2 -Warray-bounds" } */

int t[1];
int a (void);
int fct (int r, long e, int neg)
{
  int d = 0;
  if (r == 4)
    r = neg ? 3 : 2;
  if (__builtin_expect(e < -52, 0))
    d = r == 0 && a () ? 1 : 2;
  else
    {
      int i, n = 53;
      if (e < 0)
	n += e;
      for (i = 1 ; i < n / 64 + 1 ; i++)
	d = t[i]; /* { dg-bogus "array bounds" } */
    }
  return d;
}