modernc.org/ccgo/v3@v3.16.14/lib/testdata/gcc-9.1.0/gcc/testsuite/gcc.c-torture/execute/pr89634.c (about) 1 /* PR rtl-optimization/89634 */ 2 3 static unsigned long * 4 foo (unsigned long *x) 5 { 6 return x + (1 + *x); 7 } 8 9 __attribute__((noipa)) unsigned long 10 bar (unsigned long *x) 11 { 12 unsigned long c, d = 1, e, *f, g, h = 0, i; 13 for (e = *x - 1; e > 0; e--) 14 { 15 f = foo (x + 1); 16 for (i = 1; i < e; i++) 17 f = foo (f); 18 c = *f; 19 if (c == 2) 20 d *= 2; 21 else 22 { 23 i = (c - 1) / 2 - 1; 24 g = (2 * i + 1) * (d + 1) + (2 * d + 1); 25 if (g > h) 26 h = g; 27 d *= c; 28 } 29 } 30 return h; 31 } 32 33 int 34 main () 35 { 36 unsigned long a[18] = { 4, 2, -200, 200, 2, -400, 400, 3, -600, 0, 600, 5, -100, -66, 0, 66, 100, __LONG_MAX__ / 8 + 1 }; 37 if (bar (a) != 17) 38 __builtin_abort (); 39 return 0; 40 }