struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20080519-1.c
blob8f7a8a5dd709ef42e36c05eeecc1a88f8c7d94d9
1 /*
2 20080506-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 #if !defined(__SDCC_pic16) && !defined(__SDCC_pdk14) // Lack of memory
12 typedef unsigned long HARD_REG_SET[2];
13 HARD_REG_SET reg_class_contents[2];
15 struct du_chain
17 struct du_chain *next_use;
18 int cl;
21 void
22 merge_overlapping_regs (HARD_REG_SET *p)
24 if ((*p)[0] != -1 || (*p)[1] != -1)
25 ASSERT (0);
28 void
29 regrename_optimize (struct du_chain *this)
31 HARD_REG_SET this_unavailable;
32 unsigned long *scan_fp_;
33 int n_uses;
34 struct du_chain *last;
36 this_unavailable[0] = 0;
37 this_unavailable[1] = 0;
39 n_uses = 0;
40 for (last = this; last->next_use; last = last->next_use)
42 scan_fp_ = reg_class_contents[last->cl];
43 n_uses++;
44 this_unavailable[0] |= ~ scan_fp_[0];
45 this_unavailable[1] |= ~ scan_fp_[1];
47 if (n_uses < 1)
48 return;
50 scan_fp_ = reg_class_contents[last->cl];
51 this_unavailable[0] |= ~ scan_fp_[0];
52 this_unavailable[1] |= ~ scan_fp_[1];
54 merge_overlapping_regs (&this_unavailable);
56 #endif
58 void
59 testTortureExecute (void)
61 #if !defined(__SDCC_pic16) && !defined(__SDCC_pdk14) // Lack of memory
62 struct du_chain du1 = { 0, 0 };
63 struct du_chain du0 = { &du1, 1 };
64 reg_class_contents[0][0] = -1;
65 reg_class_contents[0][1] = -1;
66 reg_class_contents[1][0] = 0;
67 reg_class_contents[1][1] = 0;
68 regrename_optimize (&du0);
69 return;
70 #endif