1 /* { dg-do run } */ 2 /* { dg-options "-O2 -fdump-tree-strlen" } */ 3 4 #include "strlenopt.h" 5 6 volatile int v; 7 8 size_t f1(char * a1)9f1 (char *a1) 10 { 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); 19 } 20 21 int main()22main () 23 { 24 char a[30]; 25 strcpy (a, "abcd"); 26 if (f1 (a) != 7) 27 abort (); 28 return 0; 29 } 30 31 /* { dg-final { scan-tree-dump-times "strlen \\(" 1 "strlen" } } */ 32