1 /* Copyright (C) 2000 Free Software Foundation.
3 Ensure all expected transformations of builtin strpbrk occur and
6 Written by Kaveh R. Ghazi, 11/6/2000. */
8 extern void abort(void);
9 extern char *strpbrk (const char *, const char *);
10 extern int strcmp (const char *, const char *);
12 void fn (const char *foo
, const char *const *bar
)
14 if (strcmp(strpbrk ("hello world", "lrooo"), "llo world") != 0)
16 if (strpbrk (foo
, "") != 0)
18 if (strpbrk (foo
+ 4, "") != 0)
20 if (strpbrk (*bar
--, "") != 0)
22 if (strpbrk (*bar
, "h") != foo
)
24 if (strpbrk (foo
, "h") != foo
)
26 if (strpbrk (foo
, "w") != foo
+ 6)
28 if (strpbrk (foo
+ 6, "o") != foo
+ 7)
31 /* Test at least one instance of the __builtin_ style. We do this
32 to ensure that it works and that the prototype is correct. */
33 if (__builtin_strpbrk (foo
+ 6, "o") != foo
+ 7)
39 const char *const foo
[] = { "hello world", "bye bye world" };
46 /* When optimizing, all the above cases should be transformed into
47 something else. So any remaining calls to the original function
49 __attribute__ ((noinline
))
51 strpbrk(const char *s1
, const char *s2
)