struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug1757671.c
blobf4ab1718fff0a82e996cd16349e874dfeb65cc30
1 /*
2 bug1757671.c
3 */
5 #include <testfwk.h>
6 #include <stdint.h>
8 #ifndef __SDCC_pdk14 // Lack of memory
9 struct c
11 float r;
14 void clamp(struct c *l)
16 if(l->r > 240.0f)
17 l->r = 240.0f;
18 if(l->r < 1.0f)
19 l->r = 1.0f;
22 //char cmplong(char x, char y)
23 char cmplong(int32_t x, int32_t y)
25 if (x < y)
26 return 1;
27 return 0;
29 #endif
31 void testBug(void)
33 #ifndef __SDCC_pdk14 // Lack of memory
34 // volatile char x = 0xBF;//800000; //-1.0
35 // volatile char y = 0x3F;//800000; //+1.0
36 // volatile char z = 0x43;//700000; //+240.0
37 volatile int32_t x = 0xBF800000; //-1.0
38 volatile int32_t y = 0x3F800000; //+1.0
39 volatile int32_t z = 0x43700000; //+240.0
40 struct c val = { -1.0 };
41 clamp(&val);
42 ASSERT (val.r == 1.0);
43 ASSERT (x <= y);
44 ASSERT (cmplong(x, y));
45 ASSERT (x < z);
46 ASSERT (cmplong(x, z));
47 #endif