* patch by J. Gareth Moreton: fixes internal error 200405231 with inline, resolves

git-svn-id: trunk@44119 -
This commit is contained in:
florian 2020-02-05 20:35:03 +00:00
parent 38d0a9af48
commit 2d47013cd1
3 changed files with 40 additions and 1 deletions

1
.gitattributes vendored
View File

@ -17954,6 +17954,7 @@ tests/webtbs/tw3540.pp svneol=native#text/plain
tests/webtbs/tw3546.pp svneol=native#text/plain
tests/webtbs/tw35533.pp svneol=native#text/pascal
tests/webtbs/tw3554.pp svneol=native#text/plain
tests/webtbs/tw35590.pp svneol=native#text/pascal
tests/webtbs/tw35626.pp -text svneol=native#text/pascal
tests/webtbs/tw3564.pp svneol=native#text/plain
tests/webtbs/tw3567.pp svneol=native#text/plain

View File

@ -4815,7 +4815,10 @@ implementation
assigned(hp^.def) and
is_managed_type(hp^.def) then
begin
include(current_procinfo.flags,pi_needs_implicit_finally);
{ If it needs an implicit finally block, the relevant flag should
have been set in the first pass. Note that we can't set it here
because "add_entry_exit_code" has already been called, and
setting the flag now will raise Internal Error 200405231. [Kit] }
tg.temp_to_ref(hp,href);
g_finalize(list,hp^.def,href);
end;

35
tests/webtbs/tw35590.pp Normal file
View File

@ -0,0 +1,35 @@
{$mode objfpc}
{$inline on}
{$h+}
program project1;
function sLow: integer; inline;
begin result := 1; end;
function sHigh( const s: string): integer; inline;
begin result := Length(s); end;
procedure insert2( const substr: string; var s: string; index: integer);
begin insert( substr, s, index); end;
function replaceChars(const s, subStr: string): string;
var i: integer;
begin
result := s;
// ok with sHigh(s) or with non-inlined sHigh(result)
for i := sHigh(result) downto sLow() do begin
delete( result, i, 1);
insert2( subStr, result, i); // ok with (unwrapped) insert( subStr, result, i)
end;
end; // Error: Internal error 200405231
procedure test1;
var s, newChar, r: ansistring;
begin
s := 'old'; newChar := 'Replace';
r := replaceChars( s, newChar);
end;
begin
test1;
end.