2018-04-09 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / strlenopt-35.c
blob03b3e13a8e278c510f58b21cd61ef151bdf419b6
1 /* { dg-do run } */
2 /* { dg-options "-O2 -fdump-tree-strlen" } */
4 #include "strlenopt.h"
6 volatile int v;
8 size_t
9 f1 (char *a1)
11 v += 1;
12 size_t x = strlen (a1);
13 char *a2 = a1 + x;
14 a2[0] = '1';
15 a2[1] = '2';
16 a2[2] = '3';
17 a2[3] = 0;
18 return strlen (a1);
21 int
22 main ()
24 char a[30];
25 strcpy (a, "abcd");
26 if (f1 (a) != 7)
27 abort ();
28 return 0;
31 /* { dg-final { scan-tree-dump-times "strlen \\(" 1 "strlen" } } */