Skip analyzer strndup test on hppa*-*-hpux*
[official-gcc.git] / gcc / testsuite / gcc.dg / strlenopt-33.c
blob4903a91a0a4ff3722ae20ccca66d0c8e09eab9e8
1 /* { dg-do run } */
2 /* { dg-options "-O2 -fdump-tree-strlen" } */
4 #include "strlenopt.h"
6 volatile int v;
8 size_t __attribute__ ((noinline, noclone))
9 f1 (char *b)
11 char a[30];
12 v += 1;
13 strcpy (a, b);
14 // This needs to stay.
15 int len1 = strlen (a);
16 a[0] = '_';
17 a[1] = 0;
18 return len1 + strlen (a);
21 size_t __attribute__ ((noinline, noclone))
22 f2 (char *a, char *b)
24 v += 2;
25 strcpy (a, b);
26 // This needs to stay.
27 int len1 = strlen (a);
28 a[0] = '_';
29 a[1] = 0;
30 return len1 + strlen (a);
33 int
34 main ()
36 char a[30];
37 if (f1 ("foo") != 4 || f2 (a, "foobar") != 7)
38 abort ();
39 return 0;
42 /* { dg-final { scan-tree-dump-times "strlen \\(" 2 "strlen1" } } */