struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-2932.c
blobd3869010615e972c578846af4a9ec3982e20323d
1 /*
2 bug-932.c
4 For a basic block that consists of only a call two al __smallc function with at least two parameters,
5 the sch pointer of a basic block could be wrong, resulting in incorrect live-range for some corner cases,
6 which in turn for some corner cases could result in live-range separation incorrectly assuming an
7 iCode to be dead, which resulted in changes to the iCode that triggered a segfault in the z80 register allocator.
8 */
10 #include <testfwk.h>
12 #ifdef __SDCC
13 #pragma disable_warning 85
14 #endif
16 int fg(void *fp)
18 volatile int i = 1;
19 return i;
22 extern int fp(int c, void *fp) __smallc
24 return -1;
27 void *infile, *outfile;
28 static unsigned long int textsize = 0;
30 int error;
32 static void Error(const char *message)
34 error++;
37 #define THRESHOLD 2
39 static int DecodeChar(void)
41 volatile int i = 255;
42 return i;
45 static void Decode(void)
47 int j, k, c;
48 unsigned long int count;
50 textsize = fg(infile);
52 for (count = 0; count < textsize; ) {
53 c = DecodeChar();
54 if (c < 256) {
55 if (fp(c, outfile) == -1) {
56 Error("");
58 count++;
59 } else {
60 j = c - 255 + THRESHOLD;
61 for (k = 0; k < j; k++) {
62 count++;
68 void testBug(void)
70 error = 0;
71 Decode();
72 ASSERT (error == 1);