struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-3087.c
blob8228c957b5df748991e4034a515e442c80e6dbf9
1 /* bug-3087.c
2 A bug in z80 register allocation resultingin broken code for gbz80.
3 */
5 #include <testfwk.h>
7 #ifndef PORT_HOST
8 #pragma disable_warning 84
9 #endif
11 void Proc_2 (int *Int_Par_Ref)
13 Int_Par_Ref;
16 void Proc_7 (int Int_1_Par_Val, int Int_2_Par_Val, int *Int_Par_Ref)
18 Int_1_Par_Val;
19 Int_2_Par_Val;
20 *Int_Par_Ref = 1;
24 int f(void)
26 int Int_1_Loc;
27 int Int_2_Loc;
28 int Int_3_Loc;
29 int Run_Index;
30 int Number_Of_Runs;
32 Number_Of_Runs = 2;
34 for (Run_Index = 1; Run_Index <= Number_Of_Runs; ++Run_Index)
37 Int_1_Loc = 2;
38 Int_2_Loc = 3;
40 while (Int_1_Loc < Int_2_Loc)
42 Proc_7 (Int_1_Loc, Int_2_Loc, &Int_3_Loc);
43 Int_1_Loc += 1;
46 Int_2_Loc = Int_2_Loc * Int_1_Loc;
47 Int_1_Loc = Int_2_Loc / Int_3_Loc;
48 Int_2_Loc = 7 * (Int_2_Loc - Int_3_Loc) - Int_1_Loc; // Operand overwritten on second subtraction.
49 Proc_2 (&Int_1_Loc);
52 return Int_2_Loc;
55 void
56 testBug(void)
58 ASSERT(f() == 47);