1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
/*
string-opt-18.c from the execute part of the gcc torture tests.
*/
#include <testfwk.h>
#ifdef __SDCC
#pragma std_c99
#endif
/* Copyright (C) 2003 Free Software Foundation.
Test equal pointer optimizations don't break anything.
Written by Roger Sayle, July 14, 2003. */
#include <string.h>
#ifndef __SDCC_pdk14 // Lack of memory
void test1 (void *ptr)
{
if (memcpy(ptr,ptr,8) != ptr)
ASSERT (0);
}
#if 0
// GNU-specific function
void test2 (char *ptr)
{
if (mempcpy(ptr,ptr,8) != ptr+8)
ASSERT (0);
}
#endif
void test3 (void *ptr)
{
if (memmove(ptr,ptr,8) != ptr)
ASSERT (0);
}
void test4 (char *ptr)
{
if (strcpy(ptr,ptr) != ptr)
ASSERT (0);
}
void test5 (void *ptr)
{
if (memcmp(ptr,ptr,8) != 0)
ASSERT (0);
}
void test6 (const char *ptr)
{
if (strcmp(ptr,ptr) != 0)
ASSERT (0);
}
void test7 (const char *ptr)
{
if (strncmp(ptr,ptr,8) != 0)
ASSERT (0);
}
#endif
void
testTortureExecute (void)
{
#ifndef __SDCC_pdk14 // Lack of memory
char buf[10];
test1 (buf);
#if 0
test2 (buf);
#endif
test3 (buf);
#if !defined (__APPLE__)
test4 (buf);
#endif
test5 (buf);
test6 (buf);
test7 (buf);
return;
#endif
}
|