From dbeb3e060f5ffd959b4005bf8dd7ac7afaef8c5f Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sat, 25 Apr 2009 11:40:02 +0000 Subject: [PATCH] * 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 - --- .gitattributes | 1 + compiler/x86/nx86cnv.pas | 9 ++++++--- tests/tbs/tb0558.pp | 19 +++++++++++++++++++ 3 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 tests/tbs/tb0558.pp diff --git a/.gitattributes b/.gitattributes index a419be8ccc..ba827d4592 100644 --- a/.gitattributes +++ b/.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 diff --git a/compiler/x86/nx86cnv.pas b/compiler/x86/nx86cnv.pas index 77d44438db..31caaded4f 100644 --- a/compiler/x86/nx86cnv.pas +++ b/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); diff --git a/tests/tbs/tb0558.pp b/tests/tbs/tb0558.pp new file mode 100644 index 0000000000..1657f8e67e --- /dev/null +++ b/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.