1 /* Copyright (C) 2000 Free Software Foundation.
3 Ensure all expected transformations of builtin strstr occur and
6 Written by Kaveh R. Ghazi, 11/6/2000. */
8 extern void abort(void);
9 extern char *strstr (const char *, const char *);
13 const char *const foo
= "hello world";
15 if (strstr (foo
, "") != foo
)
17 if (strstr (foo
+ 4, "") != foo
+ 4)
19 if (strstr (foo
, "h") != foo
)
21 if (strstr (foo
, "w") != foo
+ 6)
23 if (strstr (foo
+ 6, "o") != foo
+ 7)
25 if (strstr (foo
+ 1, "world") != foo
+ 6)
28 /* Test at least one instance of the __builtin_ style. We do this
29 to ensure that it works and that the prototype is correct. */
30 if (__builtin_strstr (foo
+ 1, "world") != foo
+ 6)
37 /* When optimizing, all the above cases should be transformed into
38 something else. So any remaining calls to the original function
40 __attribute__ ((noinline
))
42 strstr(const char *s1
, const char *s2
)