mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-06 11:28:06 +02:00
* fix life information propagation for while loops, resolves #39971
* warnings/errors fixed which are caused by the new life information propagation + test
This commit is contained in:
parent
e63cc73cfa
commit
3fa77a4f62
@ -3486,7 +3486,8 @@ implementation
|
||||
prevline := 1;
|
||||
prevfileidx := 1;
|
||||
prevlabel := nil;
|
||||
nolineinfolevel:=0;
|
||||
nolineinfolevel := 0;
|
||||
hpend := nil;
|
||||
while assigned(hp) do
|
||||
begin
|
||||
case hp.typ of
|
||||
|
@ -1675,13 +1675,13 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
|
||||
srsym:=get_next_varsym(def,symlist,symidx);
|
||||
recsym := nil;
|
||||
startoffset:=curoffset;
|
||||
error := false;
|
||||
while token<>_RKLAMMER do
|
||||
begin
|
||||
s:=pattern;
|
||||
sorg:=orgpattern;
|
||||
consume(_ID);
|
||||
consume(_COLON);
|
||||
error := false;
|
||||
recsym := tsym(def.symtable.Find(s));
|
||||
if not assigned(recsym) then
|
||||
begin
|
||||
|
@ -289,7 +289,12 @@ unit optdfa;
|
||||
{ for while loops, node use set is included at the beginning of loop }
|
||||
l:=twhilerepeatnode(node).right.optinfo^.life;
|
||||
if lnf_testatbegin in twhilerepeatnode(node).loopflags then
|
||||
DFASetIncludeSet(l,node.optinfo^.use);
|
||||
begin
|
||||
DFASetIncludeSet(l,node.optinfo^.use);
|
||||
{ ... loop body could be skipped, so include life info of the successsor node }
|
||||
if assigned(node.successor) then
|
||||
DFASetIncludeSet(l,node.successor.optinfo^.life);
|
||||
end;
|
||||
|
||||
UpdateLifeInfo(node,l);
|
||||
|
||||
|
@ -505,6 +505,7 @@ uses
|
||||
for j:=0 to formalobjdef.implementedinterfaces.count-1 do
|
||||
begin
|
||||
objdef:=paraobjdef;
|
||||
intffound:=false;
|
||||
while assigned(objdef) do
|
||||
begin
|
||||
intffound:=assigned(
|
||||
|
@ -69,6 +69,7 @@ function ModulesLinkToLibc:boolean;
|
||||
var
|
||||
hp: tmodule;
|
||||
begin
|
||||
result:=false;
|
||||
{ This is called very early, ImportLibraryList is not yet merged into linkothersharedlibs.
|
||||
The former contains library names qualified with prefix and suffix (coming from
|
||||
"external 'c' name 'foo' declarations), the latter contains raw names (from "$linklib c"
|
||||
|
@ -334,11 +334,12 @@ function ModulesLinkToLibc:boolean;
|
||||
var
|
||||
hp: tmodule;
|
||||
begin
|
||||
result:=false;
|
||||
{ This is called very early, ImportLibraryList is not yet merged into linkothersharedlibs.
|
||||
The former contains library names qualified with prefix and suffix (coming from
|
||||
"external 'c' name 'foo' declarations), the latter contains raw names (from "$linklib c"
|
||||
directives). }
|
||||
hp:=tmodule(loaded_units.first);
|
||||
hp:=tmodule(loaded_units.first);
|
||||
while assigned(hp) do
|
||||
begin
|
||||
result:=Assigned(hp.ImportLibraryList.find(target_info.sharedClibprefix+'c'+target_info.sharedClibext));
|
||||
|
@ -136,6 +136,7 @@ implementation
|
||||
begin
|
||||
if target_info.system=system_i386_win32 then
|
||||
begin
|
||||
linkcygwin := false;
|
||||
hp:=tmodule(loaded_units.first);
|
||||
while assigned(hp) do
|
||||
begin
|
||||
|
@ -37,6 +37,7 @@ var
|
||||
c1: Word;
|
||||
begin
|
||||
counter:=0;
|
||||
c1 := 0;
|
||||
while counter<len do
|
||||
begin
|
||||
c1 := ord(s1[counter]);
|
||||
|
19
tests/webtbs/tw39971.pp
Normal file
19
tests/webtbs/tw39971.pp
Normal file
@ -0,0 +1,19 @@
|
||||
{ %opt=-O4 -Oodeadstore -S2 }
|
||||
function FileSizeFractionalPart(sz: uint64): uint32;
|
||||
var
|
||||
fr: uint32;
|
||||
begin
|
||||
fr := 0;
|
||||
while sz > 1000 do
|
||||
begin
|
||||
fr := sz mod 1024;
|
||||
sz := sz div 1024;
|
||||
end;
|
||||
result := fr;
|
||||
end;
|
||||
|
||||
begin
|
||||
writeln(FileSizeFractionalPart(12));
|
||||
if FileSizeFractionalPart(12)<>0 then
|
||||
halt(1);
|
||||
end.
|
Loading…
Reference in New Issue
Block a user