view gcc/testsuite/gcc.dg/volatile-bitfields-1.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* { dg-options "-fstrict-volatile-bitfields" } */
/* { dg-do run } */

extern int puts(const char *);
extern void abort(void) __attribute__((noreturn));

typedef struct {
  volatile unsigned short a:8, b:8;
} BitStruct;

BitStruct bits = {1, 2};

void check(int i, int j)
{
  if (i != 1 || j != 2) puts("FAIL"), abort();
}

int main ()
{
  check(bits.a, bits.b);

  return 0;
}