1 /* Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation.
3 Ensure all expected transformations of builtin strlen
4 occur and perform correctly.
6 Written by Jakub Jelinek, 11/7/2000.
8 Additional tests written by Roger Sayle, 11/02/2001:
9 Ensure all builtin strlen comparisons against zero are optimized
10 and perform correctly. The multiple calls to strcpy are to prevent
11 the potentially "pure" strlen calls from being removed by CSE. */
13 extern void abort (void);
14 extern __SIZE_TYPE__ strlen (const char *);
15 extern char *strcpy (char *, const char *);
22 const char *const foo = "hello world";
26 if (strlen (foo) != 11)
28 if (strlen (foo + 4) != 7)
30 if (strlen (foo + (x++ & 7)) != 5)
37 if (strlen (ptr) == 0)
45 if (strlen (ptr) <= 0)
49 if (strlen (ptr+3) != 0)
53 if (strlen (ptr+3) > 0)
57 if (strlen (str+3) >= 1)
60 /* Test at least one instance of the __builtin_ style. We do this
61 to ensure that it works and that the prototype is correct. */
62 if (__builtin_strlen (foo) != 11)