gcc/testsuite/gcc.c-torture/execute/pr69097-2.c
raw| 1 | /* PR tree-optimization/69097 */ |
| 2 | |
| 3 | __attribute__((noinline, noclone)) int |
| 4 | f1 (int x, int y) |
| 5 | { |
| 6 | return x % y; |
| 7 | } |
| 8 | |
| 9 | __attribute__((noinline, noclone)) int |
| 10 | f2 (int x, int y) |
| 11 | { |
| 12 | return x % -y; |
| 13 | } |
| 14 | |
| 15 | __attribute__((noinline, noclone)) int |
| 16 | f3 (int x, int y) |
| 17 | { |
| 18 | int z = -y; |
| 19 | return x % z; |
| 20 | } |
| 21 | |
| 22 | int |
| 23 | main () |
| 24 | { |
| 25 | if (f1 (-__INT_MAX__ - 1, 1) != 0 |
| 26 | || f2 (-__INT_MAX__ - 1, -1) != 0 |
| 27 | || f3 (-__INT_MAX__ - 1, -1) != 0) |
| 28 | __builtin_abort (); |
| 29 | return 0; |
| 30 | } |