gcc/testsuite/gcc.dg/torture/pr116772-1.c
raw| 1 | /* { dg-do run } */ |
| 2 | /* PR middle-end/116772 */ |
| 3 | /* The division by `/b` should not |
| 4 | be made uncondtional. */ |
| 5 | |
| 6 | int mult0(int a,int b) __attribute__((noipa)); |
| 7 | |
| 8 | int mult0(int a,int b){ |
| 9 | return (b!=0 ? (a/b)*b : 0); |
| 10 | } |
| 11 | |
| 12 | int bit_and0(int a,int b) __attribute__((noipa)); |
| 13 | |
| 14 | int bit_and0(int a,int b){ |
| 15 | return (b!=0 ? (a/b)&b : 0); |
| 16 | } |
| 17 | |
| 18 | int main() { |
| 19 | if (mult0(3, 0) != 0) |
| 20 | __builtin_abort(); |
| 21 | if (bit_and0(3, 0) != 0) |
| 22 | __builtin_abort(); |
| 23 | return 0; |
| 24 | } |