gcc/testsuite/c-c++-common/pr103798-2.c
raw| 1 | /* { dg-do run } */ |
| 2 | /* { dg-options "-O2 -fdump-tree-optimized -save-temps" } */ |
| 3 | |
| 4 | #include <string.h> |
| 5 | |
| 6 | __attribute__ ((weak)) |
| 7 | int |
| 8 | f (int a) |
| 9 | { |
| 10 | return memchr ("aE", a, 2) != NULL; |
| 11 | } |
| 12 | |
| 13 | __attribute__ ((weak)) |
| 14 | int |
| 15 | g (char a) |
| 16 | { |
| 17 | return a == 'a' || a == 'E'; |
| 18 | } |
| 19 | |
| 20 | int |
| 21 | main () |
| 22 | { |
| 23 | for (int i = 0; i < 255; i++) |
| 24 | if (f (i + 256) != g (i + 256)) |
| 25 | __builtin_abort (); |
| 26 | |
| 27 | return 0; |
| 28 | } |
| 29 | |
| 30 | /* { dg-final { scan-assembler-not "memchr" } } */ |