1 /* This test needs runtime that provides stpcpy, mempcpy and __*_chk
3 /* { dg-do run { target *-*-linux* } } */
4 /* { dg-options "-O2 -fdump-tree-strlen" } */
6 #define FORTIFY_SOURCE 2
7 #include "strlenopt-14g.c"
9 /* Compared to strlenopt-14gf.c, strcpy_chk with string literal as
10 second argument isn't being optimized by builtins.c into
12 /* { dg-final { scan-tree-dump-times "strlen \\(" 4 "strlen" } } */
13 /* { dg-final { scan-tree-dump-times "__memcpy_chk \\(" 0 "strlen" } } */
14 /* { dg-final { scan-tree-dump-times "__mempcpy_chk \\(" 0 "strlen" } } */
15 /* { dg-final { scan-tree-dump-times "__strcpy_chk \\(" 0 "strlen" } } */
16 /* { dg-final { scan-tree-dump-times "__strcat_chk \\(" 0 "strlen" } } */
17 /* { dg-final { scan-tree-dump-times "strchr \\(" 0 "strlen" } } */
18 /* { dg-final { scan-tree-dump-times "__stpcpy_chk \\(" 0 "strlen" } } */
19 /* { dg-final { scan-tree-dump-times "memcpy \\(" 1 "strlen" } } */
20 /* { dg-final { scan-tree-dump-times "mempcpy \\(" 2 "strlen" } } */
21 /* { dg-final { scan-tree-dump-times "strcpy \\(" 0 "strlen" } } */
22 /* { dg-final { scan-tree-dump-times "strcat \\(" 0 "strlen" } } */
23 /* { dg-final { scan-tree-dump-times "stpcpy \\(" 2 "strlen" } } */
24 /* { dg-final { cleanup-tree-dump "strlen" } } */