1 /* Copyright (C) 2007 Free Software Foundation.
3 Ensure all expected transformations of builtin memchr occur
6 Written by Paolo Carlini, 10/5/2007. */
8 extern void abort (void);
9 typedef __SIZE_TYPE__
size_t;
10 extern void *memchr (const void *, int, size_t);
15 const char* const foo1
= "hello world";
17 if (memchr (foo1
, 'x', 11))
19 if (memchr (foo1
, 'o', 11) != foo1
+ 4)
21 if (memchr (foo1
, 'w', 2))
23 if (memchr (foo1
+ 5, 'o', 6) != foo1
+ 7)
25 if (memchr (foo1
, 'd', 11) != foo1
+ 10)
27 if (memchr (foo1
, 'd', 10))
29 if (memchr (foo1
, '\0', 11))
31 if (memchr (foo1
, '\0', 12) != foo1
+ 11)
34 /* Test at least one instance of the __builtin_ style. We do this
35 to ensure that it works and that the prototype is correct. */
36 if (__builtin_memchr (foo1
, 'r', 11) != foo1
+ 8)