gcc/testsuite/gcc.dg/torture/pr35833.c
raw| 1 | /* { dg-do run } */ |
| 2 | /* { dg-options "-ftree-vrp" } */ |
| 3 | |
| 4 | struct S {struct S *field;}; |
| 5 | struct S True, False, Z; |
| 6 | static inline int f(void) {return 1;} |
| 7 | static inline int g(struct S **obj) { |
| 8 | return f() && *obj == &Z; |
| 9 | } |
| 10 | struct S **h(struct S **x) { |
| 11 | if (x) |
| 12 | return g(x) ? &True.field : &False.field; |
| 13 | else |
| 14 | return &True.field; |
| 15 | } |
| 16 | extern void abort (void); |
| 17 | int main() |
| 18 | { |
| 19 | if (h(&False.field) != &False.field) |
| 20 | abort (); |
| 21 | return 0; |
| 22 | } |