diff --git a/.gitattributes b/.gitattributes index ac8a53d3f4..ea0674fcee 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/compiler/hlcgobj.pas b/compiler/hlcgobj.pas index 8ebb16c9cc..a2a2aebb48 100644 --- a/compiler/hlcgobj.pas +++ b/compiler/hlcgobj.pas @@ -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; diff --git a/tests/webtbs/tw35590.pp b/tests/webtbs/tw35590.pp new file mode 100644 index 0000000000..d87d9dde4a --- /dev/null +++ b/tests/webtbs/tw35590.pp @@ -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.