From 04e7db09056c610b40621d4644063cce37865966 Mon Sep 17 00:00:00 2001 From: peter Date: Sun, 26 Dec 2004 20:09:35 +0000 Subject: [PATCH] * typecast float to non-float needs a move to memory --- compiler/ncgcnv.pas | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/compiler/ncgcnv.pas b/compiler/ncgcnv.pas index e8734e9a17..9d60832ed5 100644 --- a/compiler/ncgcnv.pas +++ b/compiler/ncgcnv.pas @@ -500,10 +500,18 @@ interface location_copy(location,left.location); { Floats should never be returned as LOC_CONSTANT, do the - moving to memory before the new size is set } - if (resulttype.def.deftype=floatdef) and - (location.loc=LOC_CONSTANT) then - location_force_mem(exprasmlist,location); + moving to memory before the new size is set. + Also when converting from a float to a non-float move + to memory first to prevent invalid LOC_FPUREGISTER locations } + if ( + (resulttype.def.deftype=floatdef) and + (location.loc=LOC_CONSTANT) + ) or + ( + (left.resulttype.def.deftype=floatdef) and + (resulttype.def.deftype<>floatdef) + ) then + location_force_mem(exprasmlist,location); { but use the new size, but we don't know the size of all arrays } newsize:=def_cgsize(resulttype.def); @@ -559,7 +567,10 @@ end. { $Log$ - Revision 1.70 2004-12-25 12:29:08 florian + Revision 1.71 2004-12-26 20:09:35 peter + * typecast float to non-float needs a move to memory + + Revision 1.70 2004/12/25 12:29:08 florian * fixed extended->double/single conversion when using sse Revision 1.69 2004/12/25 10:48:17 florian