Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / gcc.c-torture / execute / builtins / strstr.c
blobae503aa43e0ee0c05a436778d54c0d402339f2cc
1 /* Copyright (C) 2000 Free Software Foundation.
3 Ensure all expected transformations of builtin strstr occur and
4 perform correctly.
6 Written by Kaveh R. Ghazi, 11/6/2000. */
8 extern void abort(void);
9 extern char *strstr (const char *, const char *);
11 void
12 main_test (void)
14 const char *const foo = "hello world";
16 if (strstr (foo, "") != foo)
17 abort();
18 if (strstr (foo + 4, "") != foo + 4)
19 abort();
20 if (strstr (foo, "h") != foo)
21 abort();
22 if (strstr (foo, "w") != foo + 6)
23 abort();
24 if (strstr (foo + 6, "o") != foo + 7)
25 abort();
26 if (strstr (foo + 1, "world") != foo + 6)
27 abort();
29 /* Test at least one instance of the __builtin_ style. We do this
30 to ensure that it works and that the prototype is correct. */
31 if (__builtin_strstr (foo + 1, "world") != foo + 6)
32 abort();