(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
Warray-bounds-14.c
       1  /* { dg-do compile } */
       2  /* { dg-options "-O2 -Warray-bounds" } */
       3  
       4  int a[10];
       5  int foo1 (int i)
       6  {
       7    if (i < 0 || i > 9)
       8      return a[i];  /* { dg-warning "outside array bounds" } */
       9    return 0;
      10  }
      11  int foo2 (int i)
      12  {
      13    if (i < 0 || i > 8)
      14      return a[i];  /* { dg-bogus "outside array bounds" } */
      15    return 0;
      16  }
      17  int *foo3 (int i)
      18  {
      19    if (i < 0 || i > 10)
      20      return &a[i];  /* { dg-warning "outside array bounds" } */
      21    return (void *)0;
      22  }
      23  int *foo4 (int i)
      24  {
      25    if (i < 0 || i > 9)
      26      return &a[i];  /* { dg-bogus "outside array bounds" } */
      27    return (void *)0;
      28  }