summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/chkp-strlen-1.c
blob: 01a7b397e6aa671c60cf9901e64200f6ab6fe2be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
/* { dg-do compile } */
/* { dg-require-effective-target mpx } */
/* { dg-options "-fcheck-pointer-bounds -mmpx -O2 -fdump-tree-strlen" } */
/* { dg-final { scan-tree-dump "memcpy.chkp" "strlen" } } */

#include "string.h"

char *test (char *str1, char *str2)
{
  size_t len = strlen (str2);
  strcpy (str1, str2);
  return str1 + len;
}