1 // PR 20670: f29 corrupted when unwind stack. This tries to test that FP 2 // registers are properly saved and restored by defining 20 different FP 3 // local variables. 4 // { dg-do run } 5 // { dg-options "-O" } 6 #include <stdlib.h> 7 8 double zero = 0.0; 9 double another_zero = 0.0; 10 11 int 12 sub (void) 13 { 14 throw (0); 15 } 16 17 int 18 main (void) 19 { 20 double a, b, c, d, e, f, g, h, i, j; 21 double a1, b1, c1, d1, e1, f1, g1, h1, i1, j1; 22 23 a = zero; 24 b = a + 1; 25 c = b + 1; 26 d = c + 1; 27 e = d + 1; 28 f = e + 1; 29 g = f + 1; 30 h = g + 1; 31 i = h + 1; 32 j = i + 1; 33 34 a1 = another_zero; 35 b1 = a1 + 1; 36 c1 = b1 + 1; 37 d1 = c1 + 1; 38 e1 = d1 + 1; 39 f1 = e1 + 1; 40 g1 = f1 + 1; 41 h1 = g1 + 1; 42 i1 = h1 + 1; 43 j1 = i1 + 1; 44 45 try 46 { 47 sub (); 48 } 49 catch (...) 50 { 51 if (a != 0.0) 52 abort (); 53 if (b != 1.0) 54 abort (); 55 if (c != 2.0) 56 abort (); 57 if (d != 3.0) 58 abort (); 59 if (e != 4.0) 60 abort (); 61 if (f != 5.0) 62 abort (); 63 if (g != 6.0) 64 abort (); 65 if (h != 7.0) 66 abort (); 67 if (i != 8.0) 68 abort (); 69 if (j != 9.0) 70 abort (); 71 72 if (a1 != 0.0) 73 abort (); 74 if (b1 != 1.0) 75 abort (); 76 if (c1 != 2.0) 77 abort (); 78 if (d1 != 3.0) 79 abort (); 80 if (e1 != 4.0) 81 abort (); 82 if (f1 != 5.0) 83 abort (); 84 if (g1 != 6.0) 85 abort (); 86 if (h1 != 7.0) 87 abort (); 88 if (i1 != 8.0) 89 abort (); 90 if (j1 != 9.0) 91 abort (); 92 } 93 return 0; 94 } 95