struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20000605-1.c
blob15d5530642785b830dd2310aecc6697fba09a54e
1 /*
2 20000605-1.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
11 typedef struct _RenderInfo RenderInfo;
12 struct _RenderInfo
14 int y;
15 float scaley;
16 int src_y;
19 static void bar(void) { }
21 #if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Lack of memory
22 static int
23 render_image_rgb_a (RenderInfo * info)
25 int y, ye;
26 float error;
27 float step;
29 y = info->y;
30 ye = 256;
32 step = 1.0 / info->scaley;
34 error = y * step;
35 error -= ((int) error) - step;
37 for (; y < ye; y++) {
38 if (error >= 1.0) {
39 info->src_y += (int) error;
40 error -= (int) error;
41 bar();
43 error += step;
45 return info->src_y;
47 #endif
49 void
50 testTortureExecute (void)
52 #if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Lack of memory
53 RenderInfo info;
55 info.y = 0;
56 info.src_y = 0;
57 info.scaley = 1.0;
59 if (render_image_rgb_a(&info) != 256)
60 ASSERT (0);
61 return;
62 #endif