gcc/testsuite/gcc.c-torture/execute/pr54471.c
raw| 1 | /* PR tree-optimization/54471 */ |
| 2 | |
| 3 | #ifdef __SIZEOF_INT128__ |
| 4 | #define T __int128 |
| 5 | #else |
| 6 | #define T long long |
| 7 | #endif |
| 8 | |
| 9 | extern void abort (void); |
| 10 | |
| 11 | __attribute__ ((noinline)) |
| 12 | unsigned T |
| 13 | foo (T ixi, unsigned ctr) |
| 14 | { |
| 15 | unsigned T irslt = 1; |
| 16 | T ix = ixi; |
| 17 | |
| 18 | for (; ctr; ctr--) |
| 19 | { |
| 20 | irslt *= ix; |
| 21 | ix *= ix; |
| 22 | } |
| 23 | |
| 24 | if (irslt != 14348907) |
| 25 | abort (); |
| 26 | return irslt; |
| 27 | } |
| 28 | |
| 29 | int |
| 30 | main () |
| 31 | { |
| 32 | unsigned T res; |
| 33 | |
| 34 | res = foo (3, 4); |
| 35 | return 0; |
| 36 | } |