summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr44061.c
blob: 60a4260ae94c3257e9c9b37a945b1f654809ea39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* { dg-do compile } */
/* { dg-options "-O2 -Wall" } */

int a[2];
int foo (int q)
{
  if (__builtin_constant_p (q))
    {
      if (q == 4)
	return a[4]; /* { dg-bogus "array subscript is above array bounds" } */
      else
	return a[0];
    }
  else
    return a[q];
}