1 /* Copyright (C) 2004 Free Software Foundation.
3 Test strlen on const variables initialized to string literals.
5 Written by Jakub Jelinek, 9/14/2004.
8 { dg-options "-O2 -Wall -fdump-tree-optimized" } */
10 extern void abort (void);
11 extern __SIZE_TYPE__
strlen (const char *);
12 extern char *strcpy (char *, const char *);
13 static const char bar
[] = "Hello, World!";
14 static const char baz
[] = "hello, world?";
15 static const char larger
[20] = "short string";
28 if (strlen (bar
) != 13)
31 if (strlen (bar
+ 3) != 10)
34 if (strlen (&bar
[6]) != 7)
37 if (strlen (bar
+ (x
++ & 7)) != 7)
44 for (i
= 0; i
< 4; ++i
)
47 foo
= "HELLO, WORLD!";
51 foo
= "hello, world!";
55 if (strlen (foo
) != 13)
59 if (strlen (larger
) != 12)
61 if (strlen (&larger
[10]) != 2)
64 if (strlen (larger
+ (x
++ & 7)) != 5)
70 /* { dg-final { scan-tree-dump-not "strlen" "optimized" } } */