(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
strlenopt-47.c
       1  /* PR tree-optimization/86400 - set<string>::set<char (*)[2]) constructor
       2     does not work with array argument
       3     Verify that strlen() calls with two-character array elements of
       4     multidimensional arrays whose higher order dimension is 1 are not
       5     folded.
       6     { dg-do compile }
       7     { dg-options "-O2 -Wall -fdump-tree-optimized" } */
       8  
       9  #include "strlenopt.h"
      10  
      11  void f (void)
      12  {
      13    extern char a[1][2];
      14    int n = strlen (*a);
      15    if (n != 1)
      16      abort();
      17  }
      18  
      19  void g (void)
      20  {
      21    extern char b[1][2];
      22    int n = strlen (b[0]);
      23    if (n != 1)
      24      abort();
      25  }
      26  
      27  void h (void)
      28  {
      29    extern char c[1][2];
      30    int n = strlen (&c[0][0]);
      31    if (n != 1)
      32      abort();
      33  }
      34  
      35  /* { dg-final { scan-tree-dump-times "= strlen" 3 "optimized" } }
      36     { dg-final { scan-tree-dump-times "abort" 3 "optimized" } } */