Ver código fonte

* fixed internalerror(2007120903) when using -Cfsse2 in case an unsigned
32 bit subrange type with high(subrange_type) <= high(longint) is
converted to a float

git-svn-id: trunk@13037 -

Jonas Maebe 16 anos atrás
pai
commit
dbeb3e060f
3 arquivos alterados com 26 adições e 3 exclusões
  1. 1 0
      .gitattributes
  2. 6 3
      compiler/x86/nx86cnv.pas
  3. 19 0
      tests/tbs/tb0558.pp

+ 1 - 0
.gitattributes

@@ -7240,6 +7240,7 @@ tests/tbs/tb0554.pp svneol=native#text/plain
 tests/tbs/tb0555.pp svneol=native#text/plain
 tests/tbs/tb0556.pp svneol=native#text/plain
 tests/tbs/tb0557.pp svneol=native#text/plain
+tests/tbs/tb0558.pp svneol=native#text/plain
 tests/tbs/tb205.pp svneol=native#text/plain
 tests/tbs/ub0060.pp svneol=native#text/plain
 tests/tbs/ub0069.pp svneol=native#text/plain

+ 6 - 3
compiler/x86/nx86cnv.pas

@@ -262,10 +262,13 @@ implementation
               else
                 internalerror(2007120902);
             end;
-            case left.location.size of
-              OS_S32:
+            { don't use left.location.size, because that one may be OS_32/OS_64
+              if the lower bound of the orddef >= 0
+            }
+            case torddef(left.resultdef).ordtype of
+              s32bit:
                 opsize:=S_L;
-              OS_S64:
+              s64bit:
                 opsize:=S_Q;
               else
                 internalerror(2007120903);

+ 19 - 0
tests/tbs/tb0558.pp

@@ -0,0 +1,19 @@
+{ %cpu=i386}
+{ %opt=-Cfsse2 }
+
+{$mode objfpc}
+
+type
+  TChartZPosition = 0..MaxInt;
+  TDoublePoint = record x, y: double; end;
+
+var
+ d: double;
+ z: TChartZPosition;
+begin
+  d:=5.0;
+  z:=3;
+  d:=d-z;
+  if (d<>2.0) then
+    halt(1);
+end.