You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I caught a weird bug, but I am unsure which optimizer option triggers it. I have tried to make a more minimal example, but was unsuccessful, so I trimmed down my current code. Most probably not all of it is needed, but I have no idea what exactly triggers the bug.
The error appears in Stars.tru file, starting in line 33:
// something weird...
j -= 1;
// due to wrong optimization, this code does not work without NOP !!!//asm(" nop"); // introduced to fool TRSE optimizer, uncomment to get a working codeif ScreenUtil::ptr[j] = Config::BlankChar thenbegin
ScreenUtil::ptr[j] := Config::StarIdx1;
end;
Without NOP, this is the code that was generated:
; // something weird...
; Test Inc dec D
dec Stars_j
; LineNumber: 37
; Binary clause Simplified: EQUALS
; Load pointer array
tay ; optimized y, look out for bugs L22 ORG ldy Stars_j
lda (ScreenUtil_ptr),y
; Compare with pure num / var optimization
cmp #$fe;keep
Instead of loading Y with current value of variable J, some previous content of A is moved to Y and then completely wrong data is accessed. If NOP line is uncommented, correct sequence is generated:
; // something weird...
; Test Inc dec D
dec Stars_j
; LineNumber: 36
nop
; LineNumber: 37
; Binary clause Simplified: EQUALS
; Load pointer array
ldy Stars_j
lda (ScreenUtil_ptr),y
; Compare with pure num / var optimization
cmp #$fe;keep
I am unsure, but seems that origin may be the same as for this bug: #880
I caught a weird bug, but I am unsure which optimizer option triggers it. I have tried to make a more minimal example, but was unsuccessful, so I trimmed down my current code. Most probably not all of it is needed, but I have no idea what exactly triggers the bug.
The error appears in Stars.tru file, starting in line 33:
Without NOP, this is the code that was generated:
Instead of loading Y with current value of variable J, some previous content of A is moved to Y and then completely wrong data is accessed. If NOP line is uncommented, correct sequence is generated:
I am unsure, but seems that origin may be the same as for this bug: #880
ErrorOpt.zip
The text was updated successfully, but these errors were encountered: