view gcc/testsuite/gcc.dg/20141029-1.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* { dg-do compile } */
/* { dg-options "-fstrict-volatile-bitfields -fdump-rtl-final" } */

#define PERIPH (*(volatile struct system_periph *)0x81234)

struct system_periph {
  union {
    unsigned short WORD;
    struct {
      unsigned short a:1;
      unsigned short b:1;
      unsigned short  :5;
      unsigned short c:1;
      unsigned short  :8;
    } BIT;
  } ALL;
} __attribute__((aligned(2)));

void
foo()
{
  while (1)
    {
      PERIPH.ALL.BIT.a = 1;
    }
}
/* { dg-final { scan-rtl-dump-times "mem/v(/.)*:HI" 4 "final" } } */