gcc/testsuite/gcc.c-torture/execute/bitfld-10.c
raw| 1 | /* PR tree-optimization/102622 */ |
| 2 | /* Wrong code introduced due to phi-opt |
| 3 | introducing undefined signed interger overflow |
| 4 | with one bit signed integer negation. */ |
| 5 | |
| 6 | struct f{signed t:1;}; |
| 7 | int g(struct f *a, int t) __attribute__((noipa)); |
| 8 | int g(struct f *a, int t) |
| 9 | { |
| 10 | if (t) |
| 11 | a->t = -1; |
| 12 | else |
| 13 | a->t = 0; |
| 14 | int t1 = a->t; |
| 15 | if (t1) return 1; |
| 16 | return t1; |
| 17 | } |
| 18 | |
| 19 | int main(void) |
| 20 | { |
| 21 | struct f a; |
| 22 | if (!g(&a, 1)) __builtin_abort(); |
| 23 | return 0; |
| 24 | } |