Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2005-03

A bug for fpc 1.9.8?

14 messages · 7 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Zhong Wang

Hello, everyone

I am using fpc 1.9.8. I find that the function of FPSigaction in BaseUnix unit dosen't work. I use the example in the document for FPSigaction, but it can't compile, just give the following error report:

---->test.pp(25,20) Error: Identifier not found "TSigaction"
    The source code are listed as below (from the documents):
---->
Program test;

{ Program to demonstrate the SigAction function.}

{
do a kill -USR1 pid from another terminal to see what happens. replace pid with the real pid of this program.
You can get this pid by running 'ps'.
}

uses BaseUnix, Unix;
Var
   oa,na : PSigActionRec;
Procedure DoSig(sig : cint);cdecl;
begin
   writeln('Receiving signal: ',sig);
end;
begin
   new(na);
   new(oa);
   na^.sa_Handler:=TSigaction(@DoSig);
   fillchar(na^.Sa_Mask,sizeof(na^.sa_mask),#0);
   na^.Sa_Flags:=0;
   {$ifdef Linux}		// Linux specific
     na^.Sa_Restorer:=Nil;
   {$endif}
   if fpSigAction(SigUsr1,na,oa)0 then
     begin
     writeln('Error: ',fpgeterrno,'.');
     halt(1);
     end;
   Writeln ('Send USR1 signal or press <ENTER> to exit');
   readln;
end.
<----
    Can anybody would like to help me sovle this problem?
    Thank you so much.

Reply by email

Unknown author
to Zhong Wang

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

Bye Uberto

Reply by email

Vincent Snijders
to Unknown author
Show quoted text 13 lines
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.

Vincent.

Reply by email

Unknown author
to Vincent Snijders
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.

ok, at least I'm not alone! ;))
Have you tried to play with min and max currency?
I reduced the values as first try, but I could try to understand the actual limits.

Bye Uberto

Reply by email

Florian Klaempfl
to Vincent Snijders: You are not the only one, it happens to me too, using windows xp sp2 on a Pentium4 2.6…
Vincent Snijders wrote 21 lines
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

Reply by email

SteveG
to Florian Klaempfl

Happens on XPPro SP2 Pentium 4 3G as well

Florian Klaempfl wrote 33 lines
Vincent Snijders wrote: > 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 _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Vincent Snijders
to Florian Klaempfl: I tried with Windows XP now (AMD64 though), no success, i.e. it works
Florian Klaempfl wrote 26 lines
Vincent Snijders wrote: > 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
Can you run this program:
program extconst;
{$mode objfpc}{$H+}
var
   value: extended;
begin
   value := -922337203685477.5807;
   writeln(value:22:4);
   writeln(value*10000:22:0);
end.

Output with fpc 1.9.8:
-922337203685477.5800
-9223372036854775800

Output with ppc1 from 1.9.9 (cvs)
-922337203685477.7500
-9223372036854777500

the last value doesn't fit a int64, I think.

Regards,
Vincent.

Reply by email

Vincent Snijders
to SteveG: Happens on XPPro SP2 Pentium 4 3G as well
SteveG wrote 32 lines
Happens on XPPro SP2 Pentium 4 3G as well Florian Klaempfl wrote: > Vincent Snijders wrote: > >> 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.

Reply by email

Florian Klaempfl
to Vincent Snijders
Vincent Snijders wrote 73 lines
SteveG wrote: > Happens on XPPro SP2 Pentium 4 3G as well > > Florian Klaempfl wrote: > >> Vincent Snijders wrote: >> >>> 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;

Very strange ...

Reply by email

Marc Weustink
to Florian Klaempfl
Show quoted text 23 lines
Vincent Snijders wrote: > > 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;

^^^^^^^^^^^^^^

Is the swap of constants on purpose ?

Marc

Reply by email

Vincent Snijders
to Marc Weustink
Marc Weustink wrote 39 lines
>Vincent Snijders wrote: > > >>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; ^^^^^^^^^^^^^^ Is the swap of constants on purpose ?

It was on purpose, but it is wrong.

Vincent.

Reply by email

Florian Klaempfl
to Vincent Snijders: The call to GetSystemMetrics changes the FPU control word from $1372 to $1272, i.e. the…
Vincent Snijders wrote 73 lines
SteveG wrote: > Happens on XPPro SP2 Pentium 4 3G as well > > Florian Klaempfl wrote: > >> Vincent Snijders wrote: >> >>> 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.

Reply by email

Uberto Barbini
to Uberto Barbini: It doesn't work here. I've not swapped the constants anyway. Bye Uberto
Uberto Barbini wrote 7 lines
> 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. :-) It doesn't work here. I've not swapped the constants anyway.

My fault, I didn't make cycle.
It's all ok now.

Bye Uberto

Reply by email