Welcome, Guest |
You have to register before you can post on our site.
|
Online Users |
There are currently 164 online users. » 0 Member(s) | 162 Guest(s) Bing, Google
|
Latest Threads |
Strange Happenings
Forum: Bug Reports
Last Post: zedex82
05-07-2025, 09:05 AM
» Replies: 0
» Views: 26
|
.tap file code not execut...
Forum: Help & Support
Last Post: Zoran
04-28-2025, 10:59 AM
» Replies: 4
» Views: 405
|
Exit from more than one l...
Forum: Wishlist
Last Post: Duefectu
04-23-2025, 10:06 PM
» Replies: 3
» Views: 323
|
put small ASM programs li...
Forum: How-To & Tutorials
Last Post: Zoran
04-18-2025, 02:02 PM
» Replies: 6
» Views: 1,644
|
Creating +3 Menus - Loadi...
Forum: Help & Support
Last Post: merlinkv
04-16-2025, 02:08 PM
» Replies: 6
» Views: 589
|
Randomize not very random...
Forum: Help & Support
Last Post: Zoran
04-08-2025, 10:40 AM
» Replies: 4
» Views: 925
|
Scope rules
Forum: Bug Reports
Last Post: Zoran
04-04-2025, 09:46 AM
» Replies: 2
» Views: 367
|
Using constants not allow...
Forum: Bug Reports
Last Post: baltasarq
03-19-2025, 10:00 PM
» Replies: 8
» Views: 1,123
|
404 page not found
Forum: Documentation
Last Post: boriel
03-08-2025, 07:16 PM
» Replies: 5
» Views: 2,913
|
Spectrum keywords codes
Forum: Bug Reports
Last Post: boriel
03-08-2025, 11:00 AM
» Replies: 1
» Views: 437
|
|
|
Another optimizer bug (*solved*) |
Posted by: einar - 11-04-2014, 01:47 AM - Forum: Bug Reports
- Replies (3)
|
 |
Ouch! This bug gave me a headache! It took me some time to figure out the reason my game was crashing...
Take a look at this sample:
Code: sub test()
asm
call $fc12
di
ld a, $fe
ld i, a
im 2
ei
end asm
end sub
test()
Try compiling this sample above using:
Code: zxb.exe -A -O2 prog.bas
And it will produce the expected result:
Code: _test:
push ix
ld ix, 0
add ix, sp
#line 1
call $fc12
di
ld a, $fe
ld i, a
im 2
ei
#line 7
_test__leave:
ld sp, ix
pop ix
ret
However try compiling it again using:
Code: zxb.exe -A -O3 prog.bas
Now the result won't make sense anymore:
Code: _test:
push ix
ld ix, 0
add ix, sp
#line 1
call $fc12
di
im 2
ei
#line 7
_test__leave:
ld sp, ix
pop ix
ret
The problem is, the optimizer is supposed to try to optimize its own generated code only, not someone else's assembly code that it doesn't have enough information to understand!
|
|
|
|