(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
Warray-bounds-76.c
       1  /* PR tree-optimization/86650 - -Warray-bounds missing inlining context
       2     { dg-do compile }
       3     { dg-options "-O2 -Wall" } */
       4  
       5  static void f0 (int *p, int i)
       6  {
       7    p[i] = 0;         // { dg-warning "\\\[-Warray-bounds" }
       8  }
       9  
      10  // Expect two instances of the text below:
      11  // { dg-regexp "In function 'f0'," "first f0 prefix" { target *-*-* } 0 }
      12  // { dg-regexp "In function 'f0'," "second f0 prefix" { target *-*-* } 0 }
      13  
      14  static void f1 (int *p, int i) { f0 (p + 1, i + 1); }
      15  static void f2 (int *p, int i) { f1 (p + 1, i + 1); }
      16  
      17  extern int a2[2];   // { dg-note "'a2'" }
      18  
      19  void foo (void)
      20  {
      21    f1 (a2 + 1, 1);
      22  }
      23  
      24  // { dg-regexp " +inlined from 'foo' at \[^:\]+Warray-bounds-76.c:21:\\d+:" "inlined from foo" }
      25  
      26  extern int a3[3];   // { dg-note "'a3'" }
      27  
      28  void bar (void)
      29  {
      30    f2 (a3 + 1, 1);
      31  }
      32  
      33  // { dg-regexp " +inlined from 'f1' at \[^:\]+Warray-bounds-76.c:14:\\d+," "inlined from f1" }
      34  // { dg-regexp " +inlined from 'f2' at \[^:\]+Warray-bounds-76.c:15:\\d+," "inlined from f2" }
      35  // { dg-regexp " +inlined from 'bar' at \[^:\]+Warray-bounds-76.c:30:\\d+:" "inlined from bar" }