File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ /* bug #2357 - Compiler produces invalid code after d8a3938
2
+ */
3
+
4
+ unsigned long test ;
5
+
6
+ unsigned long longarray [7 ];
7
+
8
+ void jsr_threebytes (void ) {
9
+
10
+ }
11
+
12
+ /* having replaced two sty $zp with two sta $abs, but forgetting
13
+ * to update the instruction size, coptlong.c could cause a build
14
+ * error "Error: Range error (131 not in [-128..127])" if the
15
+ * computed codesize was under 126, but the real codesize was above
16
+ * 127.
17
+ * This tests verifies that the bug is fixed.
18
+ */
19
+ unsigned char __fastcall__ foo (unsigned char res )
20
+ {
21
+ if (res == 0 ) {
22
+ longarray [1 ]= test ; /* 24 bytes - but the compiler thought 22 */
23
+ longarray [2 ]= test ; /* 48 bytes - but 44 */
24
+ longarray [3 ]= test ; /* 72 bytes - 66 */
25
+ longarray [4 ]= test ; /* 96 bytes - 88 */
26
+ longarray [6 ]= test ; /* 120 bytes - 110 */
27
+ jsr_threebytes (); /* 123 - 113 */
28
+ jsr_threebytes (); /* 126 - 116 */
29
+ jsr_threebytes (); /* 129 - 119 */
30
+ }
31
+ return 0 ;
32
+ }
33
+
34
+ int main (void )
35
+ {
36
+ foo (42 );
37
+ return 0 ;
38
+ }
You can’t perform that action at this time.
0 commit comments