(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
memchr-3.c
       1  /* PR middle-end/97956 - ICE due to type mismatch in pointer_plus_expr
       2     during memchr folding
       3     { dg-do compile }
       4     { dg-options "-O2 -Wall" } */
       5  
       6  typedef __INT8_TYPE__  int8_t;
       7  typedef __INT32_TYPE__ int32_t;
       8  
       9  extern void* memchr (const void*, int, long); /* { dg-warning "-Wbuiltin-declaration-mismatch" "" { target llp64 } } */
      10  
      11  struct SX
      12  {
      13    int32_t n;
      14    int8_t a[];
      15  };
      16  
      17  const struct SX sx = { 0x1221 };
      18  const char sx_rep[] = { };
      19  
      20  void test_find (void)
      21  {
      22    int n = 0, nb = (const char*)&sx.a - (const char*)&sx;
      23    const char *p = (const char*)&sx, *q = sx_rep;
      24    n += p + 1 == memchr (p, q[1], nb);
      25  }