diff options
| author | Xavier ASUS <xavi92psx@gmail.com> | 2019-10-18 00:31:54 +0200 |
|---|---|---|
| committer | Xavier ASUS <xavi92psx@gmail.com> | 2019-10-18 00:31:54 +0200 |
| commit | 268a53de823a6750d6256ee1fb1e7707b4b45740 (patch) | |
| tree | 42c1799a9a82b2f7d9790ee9fe181d72a7274751 /support/regression/tests/bug-453196.c | |
| download | sdcc-gas-268a53de823a6750d6256ee1fb1e7707b4b45740.tar.gz | |
sdcc-3.9.0 fork implementing GNU assembler syntax
This fork aims to provide better support for stm8-binutils
Diffstat (limited to 'support/regression/tests/bug-453196.c')
| -rw-r--r-- | support/regression/tests/bug-453196.c | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/support/regression/tests/bug-453196.c b/support/regression/tests/bug-453196.c new file mode 100644 index 0000000..3b24699 --- /dev/null +++ b/support/regression/tests/bug-453196.c @@ -0,0 +1,74 @@ +/* Demonstrates the aliasing problem with the z80 port when loop + induction is turned on. Run_Index and Int_2_Loc get joined into + the same spill location. + + Stripped down version of dhry.c + */ + +#include <testfwk.h> + +#define NOENUM 1 +#define NOSTRUCTASSIGN 1 +#define REG + +#define Ident_2 1 + +typedef int Enumeration; + +typedef int One_Fifty; +typedef char Capital_Letter; + +char Ch_2_Glob; + +Enumeration Func_1 (Capital_Letter Ch_1_Par_Val, Capital_Letter Ch_2_Par_Val); + +void +testDhry(void) +{ + One_Fifty Int_1_Loc; + REG One_Fifty Int_2_Loc; + One_Fifty Int_3_Loc; + REG Capital_Letter Ch_Index; + Enumeration Enum_Loc; + REG int Run_Index; + REG int Number_Of_Runs; + + /* Must be more than 13... */ + Number_Of_Runs = 50; + + /* Main test loop */ + for (Run_Index = 1; Run_Index <= Number_Of_Runs; ++Run_Index) { + Int_1_Loc = 2; + Int_2_Loc = 3; + Enum_Loc = Ident_2; + + /* Removing this section removes the problem. */ + while (Int_1_Loc < Int_2_Loc) + { + Int_3_Loc = 5 * Int_1_Loc - Int_2_Loc; + Int_1_Loc += 1; + } + + /* Removing this section removes the problem. */ + for (Ch_Index = 'A'; Ch_Index <= Ch_2_Glob; ++Ch_Index) + { + if (Enum_Loc == Func_1 (Ch_Index, 'C')) + { + Int_2_Loc = Run_Index; + } + } + + /* Removing any one of the following lines removes the problem. */ + Int_2_Loc = Int_2_Loc * Int_1_Loc; + Int_1_Loc = Int_2_Loc / Int_3_Loc; + Int_2_Loc = 7 * (Int_2_Loc - Int_3_Loc) - Int_1_Loc; + } +} + +Enumeration Func_1 (Capital_Letter Ch_1_Par_Val, Capital_Letter Ch_2_Par_Val) +{ + UNUSED(Ch_1_Par_Val); + UNUSED(Ch_2_Par_Val); + + return 0; +} |
