aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/opt/pr36449.C
blob: f665980402b82815c123c01e7049f2a1cfd84201 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// PR middle-end/36449
// { dg-do run }
// { dg-options "-O3" }

extern "C" void exit (int);
extern "C" void abort ();

struct R
{
  short a;
  short b;
};

struct S
{
  R e;
  long f;
  long g;
};

struct T
{
  short c;
  short d;
};

struct U
{
  long h[0x1ffffff + 1];
  T i;
};

U *j;

void __attribute__((noinline))
bar ()
{
  exit (0);
}

void __attribute__((noinline))
foo ()
{
  S s;

  s.e.a = 36;
  s.e.b = 38;
  if (s.e.a == j->i.c && s.e.b == j->i.d)
    bar ();
}

int
main ()
{
  try
    {
      j = new U;
    }
  catch (...)
    {
      return 0;
    }
  j->i.c = 36;
  j->i.d = 38;
  j->h[0] = 1;
  j->h[1] = 2;
  j->h[2] = 3;
  foo ();
  abort ();
}