struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-980707-1.c
blobc6f8a8e6bb01e1cc686481bc5504d9c2f95068c9
1 /*
2 980707-1.c from the execute part of the gcc torture suite.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #pragma disable_warning 85
10 #endif
12 #include <stdlib.h>
13 #include <string.h>
15 char **
16 buildargv (char *input)
18 #if !defined(__SDCC_mcs51) && !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Use shorter array for low-memory devices.
19 static char *arglist[256];
20 #else
21 static char *arglist[8];
22 #endif
23 int numargs = 0;
25 while (1)
27 while (*input == ' ')
28 input++;
29 if (*input == 0)
30 break;
31 arglist [numargs++] = input;
32 while (*input != ' ' && *input != 0)
33 input++;
34 if (*input == 0)
35 break;
36 *(input++) = 0;
38 arglist [numargs] = NULL;
39 return arglist;
42 void
43 testTortureExecute (void)
45 char **args;
46 #if !defined(__SDCC_mcs51) && !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Use shorter array for low-memory devices.
47 char input[256];
48 #else
49 char input[8];
50 #endif
51 int i;
53 strcpy(input, " a b");
54 args = buildargv(input);
56 if (strcmp (args[0], "a"))
57 ASSERT (0);
58 if (strcmp (args[1], "b"))
59 ASSERT (0);
60 if (args[2] != NULL)
61 ASSERT (0);
63 return;