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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [builtins/] [strpcpy-2.c] - Blame information for rev 825

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* Copyright (C) 2003  Free Software Foundation.
2
 
3
   Ensure that builtin stpcpy performs correctly.
4
 
5
   Written by Jakub Jelinek, 21/05/2003.  */
6
 
7
extern void abort (void);
8
typedef __SIZE_TYPE__ size_t;
9
extern int memcmp (const void *, const void *, size_t);
10
extern char *stpcpy (char *, const char *);
11
extern int inside_main;
12
 
13
long buf1[64];
14
char *buf2 = (char *) (buf1 + 32);
15
long buf5[20];
16
char buf7[20];
17
 
18
void
19
__attribute__((noinline))
20
test (long *buf3, char *buf4, char *buf6, int n)
21
{
22
  int i = 4;
23
 
24
  if (stpcpy ((char *) buf3, "abcdefghijklmnop") != (char *) buf1 + 16
25
      || memcmp (buf1, "abcdefghijklmnop", 17))
26
    abort ();
27
 
28
  if (__builtin_stpcpy ((char *) buf3, "ABCDEFG") != (char *) buf1 + 7
29
      || memcmp (buf1, "ABCDEFG\0ijklmnop", 17))
30
    abort ();
31
 
32
  if (stpcpy ((char *) buf3 + i++, "x") != (char *) buf1 + 5
33
      || memcmp (buf1, "ABCDx\0G\0ijklmnop", 17))
34
    abort ();
35
}
36
 
37
void
38
main_test (void)
39
{
40
  /* All these tests are allowed to call mempcpy/stpcpy.  */
41
  inside_main = 0;
42
  __builtin_memcpy (buf5, "RSTUVWXYZ0123456789", 20);
43
  __builtin_memcpy (buf7, "RSTUVWXYZ0123456789", 20);
44
  test (buf1, buf2, "rstuvwxyz", 0);
45
}

powered by: WebSVN 2.1.0

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