* handle loc_jump/loc_flags in for-loop upper bound (mantis #15169)

git-svn-id: trunk@14261 -
This commit is contained in:
Jonas Maebe 2009-11-23 21:11:16 +00:00
parent 2c3c6d27d3
commit d644fc87a1
3 changed files with 37 additions and 2 deletions

1
.gitattributes vendored
View File

@ -10090,6 +10090,7 @@ tests/webtbs/tw14958a.pp svneol=native#text/plain
tests/webtbs/tw14958b.pp svneol=native#text/plain tests/webtbs/tw14958b.pp svneol=native#text/plain
tests/webtbs/tw1501.pp svneol=native#text/plain tests/webtbs/tw1501.pp svneol=native#text/plain
tests/webtbs/tw15088.pp svneol=native#text/plain tests/webtbs/tw15088.pp svneol=native#text/plain
tests/webtbs/tw15169.pp svneol=native#text/plain
tests/webtbs/tw1532.pp svneol=native#text/plain tests/webtbs/tw1532.pp svneol=native#text/plain
tests/webtbs/tw1539.pp svneol=native#text/plain tests/webtbs/tw1539.pp svneol=native#text/plain
tests/webtbs/tw1567.pp svneol=native#text/plain tests/webtbs/tw1567.pp svneol=native#text/plain

View File

@ -424,7 +424,8 @@ implementation
procedure tcgfornode.pass_generate_code; procedure tcgfornode.pass_generate_code;
var var
l3,oldclabel,oldblabel : tasmlabel; l3,oldclabel,oldblabel,
otl, ofl : tasmlabel;
temptovalue : boolean; temptovalue : boolean;
hop : topcg; hop : topcg;
hcond : topcmp; hcond : topcmp;
@ -433,6 +434,7 @@ implementation
cmp_const:Tconstexprint; cmp_const:Tconstexprint;
oldflowcontrol : tflowcontrol; oldflowcontrol : tflowcontrol;
oldexecutionweight : longint; oldexecutionweight : longint;
isjump: boolean;
begin begin
location_reset(location,LOC_VOID,OS_NO); location_reset(location,LOC_VOID,OS_NO);
oldclabel:=current_procinfo.CurrContinueLabel; oldclabel:=current_procinfo.CurrContinueLabel;
@ -454,7 +456,22 @@ implementation
} }
and not(assigned(entrylabel)); and not(assigned(entrylabel));
secondpass(t1); isjump:=(t1.expectloc=LOC_JUMP);
if isjump then
begin
otl:=current_procinfo.CurrTrueLabel;
current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel);
ofl:=current_procinfo.CurrFalseLabel;
current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel);
end;
secondpass(t1);
if t1.location.loc in [LOC_FLAGS,LOC_JUMP] then
location_force_reg(current_asmdata.CurrAsmList,t1.location,def_cgsize(t1.resultdef),false);
if isjump then
begin
current_procinfo.CurrTrueLabel:=otl;
current_procinfo.CurrFalseLabel:=ofl;
end;
{ calculate pointer value and check if changeable and if so } { calculate pointer value and check if changeable and if so }
{ load into temporary variable } { load into temporary variable }
if t1.nodetype<>ordconstn then if t1.nodetype<>ordconstn then

17
tests/webtbs/tw15169.pp Normal file
View File

@ -0,0 +1,17 @@
type
TDragHandleStyle = (dhDouble, dhNone, dhSingle);
var b : boolean;
fdraghandlestyle : TDraghandlestyle;
i : longint;
begin
i:=0;
FDraghandlestyle:=dhDouble;
for B := False to (FDragHandleStyle = dhDouble) do
inc(i);
if (i<>2) then
halt(1);
end.