1 /*
2 20050218-1.c from the execute part of the gcc torture suite.
3 */
4
5 #include <testfwk.h>
6
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
10
11 #include <string.h>
12
13 #if !defined(__SDCC_pdk14) // Lack of memory
14
15 /* PR tree-optimization/19828 */
16
17 const char *a[16] = { "a", "bc", "de", "fgh" };
18
19 int
foo(char * x,const char * y,size_t n)20 foo (char *x, const char *y, size_t n)
21 {
22 size_t i, j = 0;
23 for (i = 0; i < n; i++)
24 {
25 if (strncmp (x + j, a[i], strlen (a[i])) != 0)
26 return 2;
27 j += strlen (a[i]);
28 if (y)
29 j += strlen (y);
30 }
31 return 0;
32 }
33 #endif
34
35 void
testTortureExecute(void)36 testTortureExecute (void)
37 {
38 #if !defined(__SDCC_pdk14) // Lack of memory
39 if (foo ("abcde", (const char *) 0, 3) != 0)
40 ASSERT (0);
41 return;
42 #endif
43 }
44