ソースを参照

Merged revisions 10199 via svnmerge from
svn+ssh://[email protected]/FPC/svn/fpc/trunk

........
r10199 | jonas | 2008-02-03 23:49:06 +0100 (Sun, 03 Feb 2008) | 2 lines

* one more fix for x86 fpu stack swapping (mantis #10757)

........

git-svn-id: branches/fixes_2_2@10266 -

Jonas Maebe 17 年 前
コミット
3eeeee422c
3 ファイル変更37 行追加1 行削除
  1. 1 0
      .gitattributes
  2. 2 1
      compiler/ncgadd.pas
  3. 34 0
      tests/webtbs/tw10757.pp

+ 1 - 0
.gitattributes

@@ -7877,6 +7877,7 @@ tests/webtbs/tw1068.pp svneol=native#text/plain
 tests/webtbs/tw10681.pp svneol=native#text/plain
 tests/webtbs/tw1071.pp svneol=native#text/plain
 tests/webtbs/tw1073.pp svneol=native#text/plain
+tests/webtbs/tw10757.pp svneol=native#text/plain
 tests/webtbs/tw10800.pp svneol=native#text/plain
 tests/webtbs/tw1081.pp svneol=native#text/plain
 tests/webtbs/tw1090.pp svneol=native#text/plain

+ 2 - 1
compiler/ncgadd.pas

@@ -153,7 +153,8 @@ interface
                 left.location.register := tmpreg;
 {$ifdef x86}
                 { left operand is now on top of the stack, instead of the right one! }
-                toggleflag(nf_swapped);
+                if (right.location.loc=LOC_FPUREGISTER) then
+                  toggleflag(nf_swapped);
 {$endif x86}
               end;
           end;

+ 34 - 0
tests/webtbs/tw10757.pp

@@ -0,0 +1,34 @@
+{$MODE Objfpc}
+
+type
+  Ta = class 
+    T: array of Double;
+  end;
+
+var
+  a: Ta;
+
+function P:Ta;
+begin
+  Result := a;
+end;
+
+function M: Double;
+begin
+  Result := 300;
+end;
+
+var
+  i: Integer;
+
+begin
+  a := Ta.Create;
+  SetLength(P.T,2);
+  P.T[0] := 70;
+  P.T[1] := 80;
+  i := 0;
+  while (i < Length(P.T)) and (M > P.T[i]) do
+    Inc(i);
+  if (i<>2) then
+    halt(1);
+end.