gcc/testsuite/gcc.target/i386/pr78035.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-O2" } */ |
| 3 | /* { dg-additional-options "-fno-PIE" { target ia32 } } */ |
| 4 | |
| 5 | extern int a; |
| 6 | extern int b; |
| 7 | extern int c; |
| 8 | |
| 9 | int foo(int choose_a) |
| 10 | { |
| 11 | int *p; |
| 12 | if (choose_a) |
| 13 | p = &a; |
| 14 | else |
| 15 | p = &b; |
| 16 | return p != &c; |
| 17 | } |
| 18 | |
| 19 | int bar () |
| 20 | { |
| 21 | return &a != &c; |
| 22 | } |
| 23 | |
| 24 | /* We should not optimize away either comparison. */ |
| 25 | /* { dg-final { scan-assembler-times "cmp" 2 } } */ |