(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
c99-bool-3.c
       1  /* Test for _Bool bit-fields.  They have the semantics of _Bool, at
       2     least for now (DR#335 Spring 2007 discussion).  */
       3  /* Origin: Joseph Myers <joseph@codesourcery.com> */
       4  /* { dg-do run } */
       5  /* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
       6  struct foo
       7  {
       8    _Bool a : 1;
       9  } sf;
      10  
      11  extern void abort (void);
      12  extern void exit (int);
      13  
      14  int
      15  main (void)
      16  {
      17    int i;
      18    for (i = 0; i < sizeof (struct foo); i++)
      19      *((unsigned char *)&sf + i) = (unsigned char) -1;
      20    sf.a = 2;
      21    if (sf.a != 1)
      22      abort ();
      23    sf.a = 0;
      24    if (sf.a != 0)
      25      abort ();
      26    sf.a = 0.2;
      27    if (sf.a != 1)
      28      abort ();
      29    sf.a = &sf;
      30    if (sf.a != 1)
      31      abort ();
      32    exit (0);
      33  }