Skip analyzer strndup test on hppa*-*-hpux*
[official-gcc.git] / gcc / testsuite / gcc.dg / strlenopt-16g.c
blobe847a7aa74188f5207ee3053b610ec1378d350f4
1 /* This test needs runtime that provides stpcpy function. */
2 /* { dg-do run { target *-*-linux* *-*-gnu* *-*-uclinux* } } */
3 /* { dg-options "-O2 -fdump-tree-strlen" } */
5 #define USE_GNU
6 #include "strlenopt.h"
8 __attribute__((noinline, noclone)) char *
9 fn1 (char *p, const char *q)
11 /* This strcpy can be optimized into stpcpy. */
12 strcpy (p, q);
13 /* And this strchr into the return value from it. */
14 return strchr (p, '\0');
17 int
18 main ()
20 char buf[64];
21 const char *volatile q = "ABCDEFGH";
22 if (fn1 (buf, q) != buf + 8 || memcmp (buf, "ABCDEFGH", 9) != 0)
23 abort ();
24 return 0;
27 /* { dg-final { scan-tree-dump-times "strlen \\(" 0 "strlen1" } } */
28 /* { dg-final { scan-tree-dump-times "memcpy \\(" 0 "strlen1" } } */
29 /* { dg-final { scan-tree-dump-times "mempcpy \\(" 0 "strlen1" } } */
30 /* { dg-final { scan-tree-dump-times "strcpy \\(" 0 "strlen1" } } */
31 /* { dg-final { scan-tree-dump-times "strcat \\(" 0 "strlen1" } } */
32 /* { dg-final { scan-tree-dump-times "strchr \\(" 0 "strlen1" } } */
33 /* { dg-final { scan-tree-dump-times "stpcpy \\(" 1 "strlen1" } } */