LWG 3035. std::allocator's constructors should be constexpr
[official-gcc.git] / gcc / testsuite / gcc.dg / strlenopt-26.c
blobda2f465a5b5003fa5dca05f3a6ee00e97b98b5dd
1 /* { dg-do run } */
2 /* { dg-options "-O2 -fdump-tree-strlen" } */
4 #include "strlenopt.h"
6 __attribute__((noinline, noclone)) size_t
7 fn1 (char *p, const char *r)
9 size_t len1 = strlen (r);
10 char *q = strchr (p, '\0');
11 *q = '\0';
12 return len1 - strlen (r); // This strlen should be optimized into len1.
15 int
16 main (void)
18 char p[] = "foobar";
19 const char *volatile q = "xyzzy";
20 fn1 (p, q);
21 return 0;
24 /* { dg-final { scan-tree-dump-times "strlen \\(" 2 "strlen" } } */
25 /* { dg-final { scan-tree-dump-times "strchr \\(" 0 "strlen" } } */