mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 16:59:12 +02:00
* Fixed register live range in for-loops:
o Loop counter node is "left", not "right", o End-value register needs explicit sync. Without these changes, allocating registers in hlcg.a_cmp_reg_loc_label (at the end of loop) could reuse counter or end-value register, resulting in invalid code. git-svn-id: trunk@24924 -
This commit is contained in:
parent
ac3815fd84
commit
4a9fe5d07d
@ -401,7 +401,7 @@ implementation
|
|||||||
{ variable. The start value also doesn't matter. }
|
{ variable. The start value also doesn't matter. }
|
||||||
|
|
||||||
{ loop var }
|
{ loop var }
|
||||||
get_used_regvars(right,usedregvars);
|
get_used_regvars(left,usedregvars);
|
||||||
{ loop body }
|
{ loop body }
|
||||||
get_used_regvars(t2,usedregvars);
|
get_used_regvars(t2,usedregvars);
|
||||||
{ end value (t1) is not necessary (it cannot be a regvar, }
|
{ end value (t1) is not necessary (it cannot be a regvar, }
|
||||||
@ -818,6 +818,8 @@ implementation
|
|||||||
hlcg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrBreakLabel);
|
hlcg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrBreakLabel);
|
||||||
|
|
||||||
sync_regvars(false);
|
sync_regvars(false);
|
||||||
|
if temptovalue then
|
||||||
|
hlcg.a_reg_sync(current_asmdata.CurrAsmList,t1.location.register);
|
||||||
|
|
||||||
current_procinfo.CurrContinueLabel:=oldclabel;
|
current_procinfo.CurrContinueLabel:=oldclabel;
|
||||||
current_procinfo.CurrBreakLabel:=oldblabel;
|
current_procinfo.CurrBreakLabel:=oldblabel;
|
||||||
|
Loading…
Reference in New Issue
Block a user