GIMPLE store merging pass
[official-gcc.git] / gcc / testsuite / gcc.dg / store_merging_6.c
blob42b5c4f92dc8e99ec1a84cec4ce557eeaeab8d18
1 /* { dg-do run } */
2 /* { dg-require-effective-target non_strict_align } */
3 /* { dg-options "-O2 -fdump-tree-store-merging" } */
5 /* Check that we can widen accesses to bitfields. */
7 struct bar {
8 int a : 3;
9 unsigned char b : 4;
10 unsigned char c : 1;
11 char d;
12 char e;
13 char f;
14 char g;
17 __attribute__ ((noinline)) void
18 foozero (struct bar *p)
20 p->b = 0;
21 p->a = 0;
22 p->c = 0;
23 p->d = 0;
24 p->e = 0;
25 p->f = 0;
26 p->g = 0;
29 __attribute__ ((noinline)) void
30 foo1 (struct bar *p)
32 p->b = 3;
33 p->a = 2;
34 p->c = 1;
35 p->d = 4;
36 p->e = 5;
39 int
40 main (void)
42 struct bar p;
43 foozero (&p);
44 foo1 (&p);
45 if (p.a != 2 || p.b != 3 || p.c != 1 || p.d != 4 || p.e != 5
46 || p.f != 0 || p.g != 0)
47 __builtin_abort ();
49 return 0;
53 /* { dg-final { scan-tree-dump-times "Merging successful" 2 "store-merging" } } */