1  /* { dg-do run } */
       2  /* { dg-skip-if "" { *-*-* } { "*" } { "-O2" } } */
       3  /* { dg-options "-fsanitize=object-size" } */
       4  
       5  #define N 20
       6  
       7  struct S { int a; };
       8  
       9  __attribute__((noinline, noclone)) struct S
      10  f1 (int i)
      11  {
      12    struct S a[N];
      13    struct S *p = a;
      14    struct S s;
      15    s = p[i];
      16    return s;
      17  }
      18  
      19  int
      20  main ()
      21  {
      22    f1 (N);
      23    return 0;
      24  }
      25  
      26  /* { dg-output "load of address \[^\n\r]* with insufficient space for an object of type\[^\n\r]*(\n|\r\n|\r)" } */
      27  /* { dg-output "\[^\n\r]*note: pointer points here\[^\n\r]*(\n|\r\n|\r)" } */
      28  /* { dg-output "\[^\n\r]*\[^\n\r]*(\n|\r\n|\r)" } */
      29  /* { dg-output "\[^\n\r]*\\^" } */