aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/pr103255.c
blob: d74b054252f6c5f2aaaafdba62a172f66fb2c496 (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
38
39
40
41
/* PR tree-optimization/103255 */

struct H
{
  unsigned a;
  unsigned b;
  unsigned c;
};

#if __SIZEOF_POINTER__ >= 4
#define ADDR 0x400000
#else
#define ADDR 0x4000
#endif
#define OFF 0x20

int
main ()
{
  struct H *h = 0;
  unsigned long o;
  volatile int t = 1;

  for (o = OFF; o <= OFF; o += 0x1000)
    {
      struct H *u;
      u = (struct H *) (ADDR + o);
      if (t)
	{
	  h = u;
	  break;
	}
    }

  if (h == 0)
    return 0;
  unsigned *tt = &h->b;
  if ((__SIZE_TYPE__) tt != (ADDR + OFF + __builtin_offsetof (struct H, b)))
    __builtin_abort ();
  return 0;
}