aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/pr58145-1.c
blob: 0e236c0456d26b28e039f2e8415e613a84286f24 (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
34
35
36
37
/* PR tree-optimization/58145 */
/* { dg-do compile { target { int32plus } } } */
/* { dg-options "-O2 -fdump-tree-optimized" } */

struct S { unsigned int data : 32; };
struct T { unsigned int data; };
volatile struct S s2;

void
f1 (int val)
{
  struct S s = { .data = val };
  *(volatile struct S *) 0x880000UL = s;
}

void
f2 (int val)
{
  struct T t = { .data = val };
  *(volatile struct T *) 0x880000UL = t;
}

void
f3 (int val)
{
  *(volatile unsigned int *) 0x880000UL = val;
}

void
f4 (int val)
{
  struct S s = { .data = val };
  s2 = s;
}

/* { dg-final { scan-tree-dump-times " ={v} " 4 "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */