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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [string-opt-18.c] - Blame information for rev 297

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 297 jeremybenn
/* Copyright (C) 2003  Free Software Foundation.
2
 
3
   Test equal pointer optimizations don't break anything.
4
 
5
   Written by Roger Sayle, July 14, 2003.  */
6
 
7
extern void abort ();
8
typedef __SIZE_TYPE__ size_t;
9
 
10
extern void *memcpy(void*, const void*, size_t);
11
extern void *mempcpy(void*, const void*, size_t);
12
extern void *memmove(void*, const void*, size_t);
13
extern char *strcpy(char*, const char*);
14
extern int memcmp(const void*, const void*, size_t);
15
extern int strcmp(const char*, const char*);
16
extern int strncmp(const char*, const char*, size_t);
17
 
18
 
19
void test1 (void *ptr)
20
{
21
  if (memcpy(ptr,ptr,8) != ptr)
22
    abort ();
23
}
24
 
25
void test2 (char *ptr)
26
{
27
  if (mempcpy(ptr,ptr,8) != ptr+8)
28
    abort ();
29
}
30
 
31
void test3 (void *ptr)
32
{
33
  if (memmove(ptr,ptr,8) != ptr)
34
    abort ();
35
}
36
 
37
void test4 (char *ptr)
38
{
39
  if (strcpy(ptr,ptr) != ptr)
40
    abort ();
41
}
42
 
43
void test5 (void *ptr)
44
{
45
  if (memcmp(ptr,ptr,8) != 0)
46
    abort ();
47
}
48
 
49
void test6 (const char *ptr)
50
{
51
  if (strcmp(ptr,ptr) != 0)
52
    abort ();
53
}
54
 
55
void test7 (const char *ptr)
56
{
57
  if (strncmp(ptr,ptr,8) != 0)
58
    abort ();
59
}
60
 
61
 
62
int main ()
63
{
64
  char buf[10];
65
 
66
  test1 (buf);
67
  test2 (buf);
68
  test3 (buf);
69
  test4 (buf);
70
  test5 (buf);
71
  test6 (buf);
72
  test7 (buf);
73
 
74
  return 0;
75
}
76
 

powered by: WebSVN 2.1.0

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