summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/pr45017.c
blob: f2e02bcead6826e23ed606607ac54876d7d81478 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* { dg-do run { target i?86-*-* x86_64-*-* } } */

int tester(char *bytes)
{
  union {
      struct {
	  unsigned int r1:4;
	  unsigned int r2:4;
      } fmt;
      char value[1];
  } ovl;

  ovl.value[0] = bytes[0];
  return ovl.fmt.r1;
}
extern void abort (void);
int main()
{
  char buff = 0x2f;
  if (tester(&buff) != 0x0f)
    abort ();
  return 0;
}