blob: ed6dd0b376a2755c31bd1d8936af06b4a7ee02ef (
plain) (
blame)
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
|
/*
20031204-1.c from the execute part of the gcc torture tests.
*/
#include <testfwk.h>
#ifdef __SDCC
#pragma std_c99
#pragma disable_warning 85
#endif
/* PR optimization/13260 */
#include <string.h>
#include <stdint.h>
#ifndef __SDCC_pdk14 // Lack of memory
typedef uint32_t u32;
u32 in_aton(const char* x)
{
return 0x0a0b0c0d;
}
u32 root_nfs_parse_addr(char *name)
{
u32 addr;
int octets = 0;
char *cp, *cq;
cp = cq = name;
while (octets < 4) {
while (*cp >= '0' && *cp <= '9')
cp++;
if (cp == cq || cp - cq > 3)
break;
if (*cp == '.' || octets == 3)
octets++;
if (octets < 4)
cp++;
cq = cp;
}
if (octets == 4 && (*cp == ':' || *cp == '\0')) {
if (*cp == ':')
*cp++ = '\0';
addr = in_aton(name);
strcpy(name, cp);
} else
addr = (-1);
return addr;
}
#endif
void
testTortureExecute (void)
{
#ifndef __SDCC_pdk14 // Lack of memory
static char addr[] = "10.11.12.13:/hello";
u32 result = root_nfs_parse_addr(addr);
if (result != 0x0a0b0c0d) { ASSERT(0); }
return;
#endif
}
|