瀏覽代碼

* propagate pi_has_assembler_block and pi_uses_exceptions flags from inlined
routines to their host, as in this case the stack frame cannot be omitted
(mantis #16874)

git-svn-id: trunk@15535 -

Jonas Maebe 15 年之前
父節點
當前提交
229cbca086
共有 3 個文件被更改,包括 36 次插入1 次删除
  1. 1 0
      .gitattributes
  2. 5 1
      compiler/procinfo.pas
  3. 30 0
      tests/webtbs/tw16874.pp

+ 1 - 0
.gitattributes

@@ -10526,6 +10526,7 @@ tests/webtbs/tw16803.pp svneol=native#text/plain
 tests/webtbs/tw1681.pp svneol=native#text/plain
 tests/webtbs/tw16820.pp svneol=native#text/plain
 tests/webtbs/tw16861.pp svneol=native#text/plain
+tests/webtbs/tw16874.pp svneol=native#text/plain
 tests/webtbs/tw1696.pp svneol=native#text/plain
 tests/webtbs/tw1699.pp svneol=native#text/plain
 tests/webtbs/tw1709.pp svneol=native#text/plain

+ 5 - 1
compiler/procinfo.pas

@@ -39,7 +39,11 @@ unit procinfo;
       ;
 
     const
-      inherited_inlining_flags : tprocinfoflags = [pi_do_call];
+      inherited_inlining_flags : tprocinfoflags =
+        [pi_do_call,
+         { the stack frame can't be removed in this case }
+         pi_has_assembler_block,
+         pi_uses_exceptions];
 
 
     type

+ 30 - 0
tests/webtbs/tw16874.pp

@@ -0,0 +1,30 @@
+{ %opt=-Si }
+
+program project1;
+
+{$mode objfpc}{$H+}
+
+var
+  global: boolean;
+
+  function TestInlineExcept : boolean; inline;
+  begin
+    try
+      result := true;
+    except
+      result := false;
+    end;
+    global:=true;
+  end;
+
+begin
+  writeln('before');
+  if TestInlineExcept then begin
+    writeln('TestInlineExcept: true');
+  end else begin
+    writeln('TestInlineExcept: false');
+  end;
+  writeln('after');
+  if not global then
+    halt(1);
+end.