* handle exit(<expr>) correctly in the dfa, resolves #11848

git-svn-id: trunk@11547 -
This commit is contained in:
florian 2008-08-11 19:01:07 +00:00
parent 0789e9409d
commit 8cc0a04db5
4 changed files with 65 additions and 3 deletions

2
.gitattributes vendored
View File

@ -8096,6 +8096,7 @@ tests/webtbf/tw11295b.pp svneol=native#text/plain
tests/webtbf/tw1157a.pp svneol=native#text/plain
tests/webtbf/tw11619b.pp svneol=native#text/plain
tests/webtbf/tw11632.pp svneol=native#text/plain
tests/webtbf/tw11848a.pp svneol=native#text/plain
tests/webtbf/tw1238.pp svneol=native#text/plain
tests/webtbf/tw1251a.pp svneol=native#text/plain
tests/webtbf/tw1270.pp svneol=native#text/plain
@ -8531,6 +8532,7 @@ tests/webtbs/tw1157.pp svneol=native#text/plain
tests/webtbs/tw1157b.pp svneol=native#text/plain
tests/webtbs/tw11619.pp svneol=native#text/plain
tests/webtbs/tw1181.pp svneol=native#text/plain
tests/webtbs/tw11848.pp svneol=native#text/plain
tests/webtbs/tw1203.pp svneol=native#text/plain
tests/webtbs/tw1204.pp svneol=native#text/plain
tests/webtbs/tw1207.pp svneol=native#text/plain

View File

@ -403,9 +403,26 @@ unit optdfa;
if not(is_void(current_procinfo.procdef.returndef)) and
not(current_procinfo.procdef.proctypeoption=potype_constructor) then
begin
{ get info from faked resultnode }
node.optinfo^.use:=resultnode.optinfo^.use;
node.optinfo^.life:=node.optinfo^.use;
if not(assigned(node.optinfo^.def)) and
not(assigned(node.optinfo^.use)) then
begin
if assigned(texitnode(node).left) then
begin
node.optinfo^.def:=resultnode.optinfo^.def;
dfainfo.use:=@node.optinfo^.use;
dfainfo.def:=@node.optinfo^.def;
dfainfo.map:=map;
foreachnodestatic(pm_postprocess,texitnode(node).left,@AddDefUse,@dfainfo);
calclife(node);
end
else
begin
{ get info from faked resultnode }
node.optinfo^.use:=resultnode.optinfo^.use;
node.optinfo^.life:=node.optinfo^.use;
end;
end;
end;
end;

20
tests/webtbf/tw11848a.pp Normal file
View File

@ -0,0 +1,20 @@
{ %OPT=-Sew -Oodfa }
{ %FAIL }
{$mode objfpc}{$H+}
uses
Classes, SysUtils;
function Test(a: integer): integer;
var
i : integer;
begin
if a>0 then
i:=1
else
exit(i);
end;
begin
end.

23
tests/webtbs/tw11848.pp Normal file
View File

@ -0,0 +1,23 @@
{ %OPT=-Sew -Oodfa }
{ %NORUN }
{$mode objfpc}{$H+}
uses
Classes, SysUtils;
function Test(a: integer): integer;
var
HashItem: Pointer;
begin
HashItem:=nil;
while HashItem<>nil do begin
if (HashItem<>nil) then
exit(-1);
HashItem:=HashItem;
end;
Result:=0;
end;
begin
end.