OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [strlenopt-22.c] - Blame information for rev 689

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-O2 -fdump-tree-strlen" } */
3
 
4
#include "strlenopt.h"
5
 
6
__attribute__((noinline, noclone)) size_t
7
bar (char *p, char *q)
8
{
9
  size_t l1, l2, l3;
10
  char *r = strchr (p, '\0');
11
  strcpy (r, "abcde");
12
  char *s = strchr (r, '\0');
13
  strcpy (s, q);
14
  l1 = strlen (p);
15
  l2 = strlen (r);
16
  l3 = strlen (s);
17
  return l1 + l2 + l3;
18
}
19
 
20
int
21
main ()
22
{
23
  char buf[16] = "01234";
24
 
25
  if (bar (buf, "56789") != 30)
26
    abort ();
27
 
28
  if (memcmp (buf, "01234abcde56789", 16) != 0)
29
    abort ();
30
 
31
  return 0;
32
}
33
 
34
/* { dg-final { scan-tree-dump-times "strlen \\(" 3 "strlen" } } */
35
/* { dg-final { scan-tree-dump-times "memcpy \\(" 1 "strlen" } } */
36
/* { dg-final { scan-tree-dump-times "strcpy \\(" 1 "strlen" } } */
37
/* { dg-final { scan-tree-dump-times "strcat \\(" 0 "strlen" } } */
38
/* { dg-final { scan-tree-dump-times "strchr \\(" 1 "strlen" } } */
39
/* { dg-final { scan-tree-dump-times "stpcpy \\(" 0 "strlen" } } *
40
/* { dg-final { cleanup-tree-dump "strlen" } } */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.