Home | History | Annotate | Download | only in jni
      1 // PR middle-end/36449
      2 // { dg-do run }
      3 // { dg-options "-O3" }
      4 
      5 extern "C" void exit (int);
      6 extern "C" void abort ();
      7 
      8 struct R
      9 {
     10   short a;
     11   short b;
     12 };
     13 
     14 struct S
     15 {
     16   R e;
     17   long f;
     18   long g;
     19 };
     20 
     21 struct T
     22 {
     23   short c;
     24   short d;
     25 };
     26 
     27 struct U
     28 {
     29   long h[0x1ffffff + 1];
     30   T i;
     31 };
     32 
     33 U *j;
     34 
     35 void __attribute__((noinline))
     36 bar ()
     37 {
     38   exit (0);
     39 }
     40 
     41 void __attribute__((noinline))
     42 foo ()
     43 {
     44   S s;
     45 
     46   s.e.a = 36;
     47   s.e.b = 38;
     48   if (s.e.a == j->i.c && s.e.b == j->i.d)
     49     bar ();
     50 }
     51 
     52 int
     53 main ()
     54 {
     55   try
     56     {
     57       j = new U;
     58     }
     59   catch (...)
     60     {
     61       return 0;
     62     }
     63   j->i.c = 36;
     64   j->i.d = 38;
     65   j->h[0] = 1;
     66   j->h[1] = 2;
     67   j->h[2] = 3;
     68   foo ();
     69   abort ();
     70 }
     71