[fpc-devel] Compiling error: Invalid Floating point operation

Florian Klaempfl F.Klaempfl at gmx.de
Thu Mar 10 20:13:15 CET 2005


Vincent Snijders wrote:

> SteveG wrote:
> 
>> Happens on XPPro SP2 Pentium 4 3G as well
>>
>> Florian Klaempfl wrote:
>>
>>> Vincent Snijders wrote:
>>>
>>>> uberto at gama-soft.com wrote:
>>>>
>>>>> Compiling current cvs version  on Windows XP (cpu Athlon XP 1800)
>>>>>
>>>>> give me
>>>>> Invalid Floating point operation
>>>>> in /rtl/objpas/sysutils/sysstrh.inc 49:
>>>>>
>>>>> I fixed it decreasing MaxCurrency by 1.0 and increasing MinCurrency 
>>>>> by the same quantity.
>>>>>
>>>>> I didn't investigate it further. But I'm wondering why I'm the only 
>>>>> one with this problem.
>>>>> sysstrh.inc is version 1.15 last change by peter at 2005/2/14 17:13:31
>>>>>
>>>>
>>>> You are not the only one, it happens to me too, using windows xp sp2 
>>>> on a Pentium4 2.6 Ghz, but not using windows 2k on a Pentium4 1.5Ghz.
>>>>
>>>> Also Florian could not reproduce this problem, but somebody else on 
>>>> the Lazarus list reported this too.
>>>
>>>
>>>
>>>
>>> I tried with Windows XP now (AMD64 though), no success, i.e. it works
>>>
> 
> The call to GetSystemMetrics changes the FPU control word from $1372 to 
> $1272, i.e. the Rounding precision is changed from extended to double.
> 
> In the attached patch I set it back to the original value. Now I can 
> build a new compiler again. :-)
> 
> Regards,
> Vincent.
> 
> 
> ------------------------------------------------------------------------
> 
> Index: fpc-1.9/rtl/win32/sysutils.pp
> ===================================================================
> RCS file: /FPC/CVS/fpc/rtl/win32/sysutils.pp,v
> retrieving revision 1.43
> diff -u -r1.43 sysutils.pp
> --- fpc-1.9/rtl/win32/sysutils.pp	2 Mar 2005 21:10:08 -0000	1.43
> +++ fpc-1.9/rtl/win32/sysutils.pp	10 Mar 2005 10:43:08 -0000
> @@ -609,10 +609,15 @@
>  
>  
>  Procedure InitInternational;
> +var
> +{ A call to GetSystemMetrics changes the value if the 8087 Control Word}
> +  old8087CW: word; 
>  begin
>    InitInternationalGeneric;
> -  SysLocale.MBCS:=GetSystemMetrics(SM_DBCSENABLED)<>0;
> -  SysLocale.RightToLeft:=GetSystemMetrics(SM_MIDEASTENABLED)<>0;
> +  old8087CW:=Get8087CW;
> +  SysLocale.MBCS:=GetSystemMetrics(SM_MIDEASTENABLED)<>0;
> +  SysLocale.RightToLeft:=GetSystemMetrics(SM_DBCSENABLED)<>0;
> +  Set8087CW(old8087CW);
>    InitAnsi;
>    GetFormatSettings;
>  end;

Applied with some modifications :) Thx.




More information about the fpc-devel mailing list