(root)/
gcc-13.2.0/
gcc/
testsuite/
c-c++-common/
torture/
pr53505.c
       1  /* PR tree-optimization/53505 */
       2  /* { dg-do run } */
       3  
       4  #include <stdbool.h>
       5  
       6  struct A
       7  {
       8    unsigned int a;
       9    unsigned char c1, c2;
      10    bool b1 : 1;
      11    bool b2 : 1;
      12    bool b3 : 1;
      13  };
      14  
      15  void
      16  foo (const struct A *x, int y)
      17  {
      18    int s = 0, i;
      19    for (i = 0; i < y; ++i)
      20      {
      21        const struct A a = x[i];
      22        s += a.b1 ? 1 : 0;
      23      }
      24    if (s != 0)
      25      __builtin_abort ();
      26  }
      27  
      28  int
      29  main ()
      30  {
      31    struct A x[100];
      32    int i;
      33    __builtin_memset (x, -1, sizeof (x));
      34    for (i = 0; i < 100; i++)
      35      {
      36        x[i].b1 = false;
      37        x[i].b2 = false;
      38        x[i].b3 = false;
      39      }
      40    foo (x, 100);
      41    return 0;
      42  }