Ver Fonte

-- Zusammenführen von r44119 in ».«:
U compiler/hlcgobj.pas
A tests/webtbs/tw35590.pp
-- Aufzeichnung der Informationen für Zusammenführung von r44119 in ».«:
U .

git-svn-id: branches/fixes_3_2@47152 -

florian há 4 anos atrás
pai
commit
52235af80c
3 ficheiros alterados com 40 adições e 1 exclusões
  1. 1 0
      .gitattributes
  2. 4 1
      compiler/hlcgobj.pas
  3. 35 0
      tests/webtbs/tw35590.pp

+ 1 - 0
.gitattributes

@@ -17641,6 +17641,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

+ 4 - 1
compiler/hlcgobj.pas

@@ -4682,7 +4682,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 - 0
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.