struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-920625-1.c
blobf016b30cf21aaeaa911914715a09ddd6da1a8cb2
1 /*
2 920625-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 93
10 #endif
12 #include <stdarg.h>
14 #if !defined(__SDCC_pdk14) // Lack of memory
15 typedef struct{double x,y;}point;
16 point pts[]={{1.0,2.0},{3.0,4.0},{5.0,6.0},{7.0,8.0}};
17 static int va1(int nargs,...)
19 va_list args;
20 int i;
21 point pi;
22 va_start(args,nargs);
23 for(i=0;i<nargs;i++){
24 pi=va_arg(args,point);
25 if(pts[i].x!=pi.x||pts[i].y!=pi.y)ASSERT(0);
27 va_end(args);
30 typedef struct{int x,y;}ipoint;
31 ipoint ipts[]={{1,2},{3,4},{5,6},{7,8}};
32 static int va2(int nargs,...)
34 va_list args;
35 int i;
36 ipoint pi;
37 va_start(args,nargs);
38 for(i=0;i<nargs;i++){
39 pi=va_arg(args,ipoint);
40 if(ipts[i].x!=pi.x||ipts[i].y!=pi.y)ASSERT(0);
42 va_end(args);
44 #endif
46 void
47 testTortureExecute (void)
49 #if !defined(__SDCC_pdk14) // Lack of memory
50 va1(4,pts[0],pts[1],pts[2],pts[3]);
51 va2(4,ipts[0],ipts[1],ipts[2],ipts[3]);
52 return;
53 #endif