PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / strlenopt-27.c
blobc539edb821ccc7cc0e14c8a850c743e0aef30641
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)
9 strcpy (p, "foobar");
10 return strlen (p + 2); // This strlen should be optimized into 4.
13 int
14 main (void)
16 char p[] = "barfoo";
17 if (fn1 (p) != 4)
18 abort ();
19 return 0;
22 /* { dg-final { scan-tree-dump-times "strlen \\(" 0 "strlen" } } */