Browse Source

* fixed bug #9107: procedure which have pushed parameters in its body fails if only -OoSTACKFRAME switch is used.
+ test.

git-svn-id: trunk@7731 -

yury 18 years ago
parent
commit
a4dfa3b4fd
3 changed files with 20 additions and 1 deletions
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/ncal.pas
  3. 18 0
      tests/webtbs/tw9107.pp

+ 1 - 0
.gitattributes

@@ -8303,6 +8303,7 @@ tests/webtbs/tw9054.pp svneol=native#text/plain
 tests/webtbs/tw9076.pp svneol=native#text/plain
 tests/webtbs/tw9076a.pp svneol=native#text/plain
 tests/webtbs/tw9085.pp svneol=native#text/plain
+tests/webtbs/tw9107.pp svneol=native#text/plain
 tests/webtbs/ub1873.pp svneol=native#text/plain
 tests/webtbs/ub1883.pp svneol=native#text/plain
 tests/webtbs/uw0555.pp svneol=native#text/plain

+ 1 - 1
compiler/ncal.pas

@@ -2851,7 +2851,7 @@ implementation
            begin
              tcallparanode(left).det_registers;
 
-             if cs_opt_level1 in current_settings.optimizerswitches then
+             if (current_settings.optimizerswitches*[cs_opt_stackframe,cs_opt_level1]<>[]) then
                begin
                  { check for stacked parameters }
                  check_stack_parameters;

+ 18 - 0
tests/webtbs/tw9107.pp

@@ -0,0 +1,18 @@
+{%opt=-OoSTACKFRAME}
+
+procedure Proc;
+var
+  s:shortstring;
+begin
+  s:='test';
+  if Copy(s,1,4)<>'test' then begin
+    writeln('Test failed!');
+    Halt(1);
+  end
+  else
+    writeln('Test OK.');
+end;
+
+begin
+  Proc;
+end.