aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/pr17112-1.c
blob: d43868fe0744b2968f1976a21fb06b697a2a2e93 (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
25
26
27
28
29
30
31
32
33
/* PR middle-end/17112 */
/* { dg-do run } */
/* { dg-require-effective-target int32plus } */
/* { dg-options "-O2" } */

extern void abort(void);

typedef struct {
  int int24:24  __attribute__ ((packed));
} myint24;

myint24 x[3] = {
  0x123456,
  0x789abc,
  0xdef012
};

myint24 y[3];  // starts out as zeros

void foo()
{
  y[1] = x[1];
}

int main()
{
  foo();

  if (y[0].int24 != 0 || y[2].int24 != 0)
    abort();
  return 0;
}