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.