| 1 |
// PR c++/113706 |
| 2 |
/* A variant of the pr103798-2.c test with const void * memchr return type, as |
| 3 |
specified by the C++ standard. */ |
| 4 |
/* { dg-do run } */ |
| 5 |
/* { dg-options "-O2 -fdump-tree-optimized -save-temps" } */ |
| 6 |
|
| 7 |
extern "C" const void *memchr (const void *, int, __SIZE_TYPE__); // { dg-bogus "built-in" } |
| 8 |
|
| 9 |
__attribute__ ((weak)) |
| 10 |
int |
| 11 |
f (int a) |
| 12 |
{ |
| 13 |
return memchr ("aE", a, 2) != 0; |
| 14 |
} |
| 15 |
|
| 16 |
__attribute__ ((weak)) |
| 17 |
int |
| 18 |
g (char a) |
| 19 |
{ |
| 20 |
return a == 'a' || a == 'E'; |
| 21 |
} |
| 22 |
|
| 23 |
int |
| 24 |
main () |
| 25 |
{ |
| 26 |
for (int i = 0; i < 255; i++) |
| 27 |
if (f (i + 256) != g (i + 256)) |
| 28 |
__builtin_abort (); |
| 29 |
|
| 30 |
return 0; |
| 31 |
} |
| 32 |
|
| 33 |
/* { dg-final { scan-assembler-not "memchr" } } */ |