[fpc-devel] TInetSocket connect timeout
Hi, the TInetSocket ConnectTimeout cannot be smaller than 1 second. The reason is that the TInetSocket's CheckSocketConnectTimeout function has the microseconds field (tv_usec) of locTimeVal (PTimeVal) variable always zero . I created a PR ( https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/239 ) to fix this. regards, -- Dimitrios Chr. Ioannidis ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] JVM testing on x86_64
Here it is. https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/237 By the way - thanks for telling me to test my typeconv strip on JVM. I've got a failure that I need to investigate now. Gareth aka. Kit -- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] JVM testing on x86_64
On 2022-06-08 21:10, J. Gareth Moreton via fpc-devel wrote: Thanks for your help. I've had to make a lot of changed to testall.bat since it was malformed in places. I've got it working now though. Would there be interest in me creating a merge request with the improved TESTALL.BAT file for tests/test/jvm? Yes, definitely. Thanks! Jonas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] JVM testing on x86_64
Hi Jonas, Thanks for your help. I've had to make a lot of changed to testall.bat since it was malformed in places. I've got it working now though. Would there be interest in me creating a merge request with the improved TESTALL.BAT file for tests/test/jvm? Gareth aka. Kit On 08/06/2022 16:42, Jonas Maebe via fpc-devel wrote: On 2022-06-08 15:15, J. Gareth Moreton via fpc-devel wrote: The testall.bat file took some modification since it doesn't handle parameters like testall.sh does. I didn't get too far though: You have to install our own, patched version of Jasmin: https://wiki.freepascal.org/FPC_JVM#Download Jonas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel -- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] ConvUtils: ConvTypeToFamily and ConvFamilyToDescription conundrums
On Wed, Jun 8, 2022 at 3:24 PM Marco van de Voort via fpc-devel wrote: > I doubt that there are mission critical convutils programs out there, > given the fact that it took 10+ years to find out the temperature > conversion didn't work :-) I agree. I only stubled upon this unit because I have unit that converses integers to string in a base (up to base 36) and I wondered if fpc had a general conversion unit, where perhaps it could be added. That's how I found the StdConvs unit and then discovered the temperature bug. The rest is, as they say, history. > Usage is low, risk is small, I say, go ahead. This still leaves us with the returnvalue of ConvTypeToFamily, which should indicate if an has occurred. However, at least in D7, ConvTypeToFamily does NOT return 0 if an error occurs, but it raises an exception. So, what to do for that one: follow the docs, or follow the observed behavoir of D7 (again, someone should test a newer version)? Basically since both TConvFamily and TConvType are of type Word (in Delphi), it is impossible to return a number that indicates an error at all (unless you fill both Families[0] and RegisteredConvTypes[0] with info indicating they are invalid (which D7 seems not to do). Which makes the CIllegalConvFamily and CIllegalConvType constants rather useless. The only function that actually returns a TConvType (AFAICS) raises an exception upon error. So, we can go 2 ways: 1. Leave TConvFamily and TConvType and change CIllegalConvFamily to -1 Not Delphi compatible 2. Make TConvFamily and TConvType of type Word, raise an exception in ConvTypeToFamily upon error. This needs some refactoring to limit the amount of TConvTypes that can be registered. It's not compliant with the Delphi docs. I would tend to also implement TryXXX functions for all procs/functions that will raise conversion exceptions in that case. Just to be consistent with most of our conversion routines we have. Then there is the issue with ConvFamilyToDescription: should it return an empty string if the family does not exist (current behaviour) or "Illegal family", as D7 does? I would leave it as it is, since "illegal family" is a legal name for a family to register... @Marco: I first need to have the patches in #39774 and #39773 applied before embarking on this. -- Bart ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] ConvUtils: ConvTypeToFamily and ConvFamilyToDescription conundrums
On Wed, Jun 8, 2022 at 3:55 PM Stefan Glienke via fpc-devel wrote: > Actually the behavior in Delphi depends on the $R switch. D7: {$R+} ConvTypeToDescription(-1)=[$] {$R-} ConvTypeToDescription(-1)=[$] Bart -- Bart ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] JVM testing on x86_64
On 2022-06-08 15:15, J. Gareth Moreton via fpc-devel wrote: The testall.bat file took some modification since it doesn't handle parameters like testall.sh does. I didn't get too far though: You have to install our own, patched version of Jasmin: https://wiki.freepascal.org/FPC_JVM#Download Jonas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] JVM testing on x86_64
Okay. got the JDK installed (and got javac), so we're making progress! Mostly... testall.sh still won't run since I'm not specifying the correct options I don't think. I've gotten testall.bat partially working, but still getting errors (I had to add the '.java' extension to JavaClass to prevent another error). C:\Users\garet\Documents\programming\fpc-opts\tests\test\jvm>javac -encoding utf-8 -cp ..\..\..\rtl\units\jvm-java;. JavaClass.java JavaClass.java:9: error: cannot find symbol TMyClass t = new TMyClass(); ^ symbol: class TMyClass location: class JavaClass JavaClass.java:9: error: cannot find symbol TMyClass t = new TMyClass(); ^ symbol: class TMyClass location: class JavaClass JavaClass.java:29: error: package test does not exist System.out.println("myrec.a should return 42: "+test.myrec.a); ^ JavaClass.java:30: error: package test does not exist System.out.println("myrec.b should return 1234: "+test.myrec.b); ^ JavaClass.java:31: error: package TMyClass does not exist System.out.println("TMyClass.rec.c should return 5678: "+TMyClass.rec.c); ^ JavaClass.java:32: error: cannot find symbol System.out.println("test.tcl should return 4: "+test.tcl); ^ symbol: variable test location: class JavaClass JavaClass.java:33: error: package test does not exist System.out.println("test.tcrec.a should return 1: "+test.tcrec.a); ^ JavaClass.java:34: error: package test does not exist System.out.println("test.tcrec.e should return 5: "+test.tcrec.e); ^ JavaClass.java:35: error: package test.tcnestrec does not exist System.out.println("test.tcnestrec.r.d should return 4: "+test.tcnestrec.r.d); ^ JavaClass.java:36: error: package test does not exist System.out.println("test.tcnestrec.r.arr[1] should return 6: "+test.tcnestrec.arr[1]); ^ JavaClass.java:37: error: cannot find symbol TMyClass.settestglobal(654321); ^ symbol: variable TMyClass location: class JavaClass JavaClass.java:38: error: cannot find symbol System.out.println("TMyClass.gettestglobal should return 654321: "+TMyClass.gettestglobal()); ^ symbol: variable TMyClass location: class JavaClass JavaClass.java:39: error: cannot find symbol System.out.println("TMyClass.staticmul3(3) should return 9: "+TMyClass.staticmul3(3)); ... And the errors continue ad infinitum. (This is on 'main', by the way) Gareth aka. Kit -- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] ConvUtils: ConvTypeToFamily and ConvFamilyToDescription conundrums
> On 08/06/2022 14:58 Bart via fpc-devel wrote: > > code like this will not raise an exception Delphi, while it does > in Fpc: > > var > L: Integer; > begin > L:=-1; > writeln('ConvTypeToDescription(L)=',ConvTypeToDescription(L)); // > prints [$] in D7, EAccessViolation in fpc > end. Actually the behavior in Delphi depends on the $R switch. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] ConvUtils: ConvTypeToFamily and ConvFamilyToDescription conundrums
On 8-6-2022 15:14, Bart via fpc-devel wrote: Changing our TConvType to word will potentially break existing programs though. I doubt that there are mission critical convutils programs out there, given the fact that it took 10+ years to find out the temperature conversion didn't work :-) Usage is low, risk is small, I say, go ahead. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] JVM testing on x86_64
The lack of "javac" is a little confusing. I have a lot to learn! Gareth aka. Kit On 08/06/2022 14:15, J. Gareth Moreton via fpc-devel wrote: The testall.bat file took some modification since it doesn't handle parameters like testall.sh does. I didn't get too far though: C:\Users\garet\Documents\programming\fpc-opts\tests\test\jvm>..\..\..\compiler\ppcjvm -Fu..\..\..\rtl\units\jvm-java -O2 -g test Generated: .\org\freepascal\test\tisclass2.class test.j:7: JAS Error: Badly formatted number. .field public static final 'unitfloatconst' F = 0fx4000 ^ test.j: Found 1 errors Generated: .\org\freepascal\test\trec.class TMyClass.j:7: JAS Error: Badly formatted number. .field public static final 'classfloatconst' F = 0fx4040 ^ TMyClass.j: Found 1 errors Generated: .\org\freepascal\test\tisinterface.class Generated: .\org\freepascal\test\tisclassbase.class Generated: .\org\freepascal\test\tisclassbase2.class Generated: .\org\freepascal\test\tisclass1.class Generated: .\org\freepascal\test\tisclass1$tisclass1nested.class Generated: .\org\freepascal\test\tisclass1$tisclass1nested$test__fpc_intern_recname_37.class Generated: .\org\freepascal\test\tisclass1$tisclass1nested$tisclass1nestedl2.class Generated: .\org\freepascal\test\tisclass1$tisclass1nested$tisclass1nestedl2$test__fpc_intern_recname_43.class Generated: .\org\freepascal\test\tnestrec.class Generated: .\org\freepascal\test\test__fpc_intern_recname_68.class C:\Users\garet\Documents\programming\fpc-opts\tests\test\jvm>javac -encoding utf-8 -cp ..\..\..\rtl\units\jvm-java;. JavaClass 'javac' is not recognized as an internal or external command, operable program or batch file. C:\Users\garet\Documents\programming\fpc-opts\tests\test\jvm>java -Dfile.encoding=UTF-8 -cp ..\..\..\rtl\units\jvm-java;. JavaClass Error: Could not find or load main class JavaClass C:\Users\garet\Documents\programming\fpc-opts\tests\test\jvm>if 1 NEQ 0 exit /b 1 I'm able to run Shell scripts on my Windows machine thanks to having a bash client installed, but testall.sh closes immediately (and it doesn't give me a chance to view the error messages) but this is probably because I haven't specified any parameters. I tried the obvious TEST_FPC=../../../compiler/ppcjvm.exe, and PPC instead of TEST_FPC, but it still closed immediately. Sorry if this is painfully obvious stuff. I will master non-Windows stuff and all eventually! Gareth aka. Kit -- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] JVM testing on x86_64
The testall.bat file took some modification since it doesn't handle parameters like testall.sh does. I didn't get too far though: C:\Users\garet\Documents\programming\fpc-opts\tests\test\jvm>..\..\..\compiler\ppcjvm -Fu..\..\..\rtl\units\jvm-java -O2 -g test Generated: .\org\freepascal\test\tisclass2.class test.j:7: JAS Error: Badly formatted number. .field public static final 'unitfloatconst' F = 0fx4000 ^ test.j: Found 1 errors Generated: .\org\freepascal\test\trec.class TMyClass.j:7: JAS Error: Badly formatted number. .field public static final 'classfloatconst' F = 0fx4040 ^ TMyClass.j: Found 1 errors Generated: .\org\freepascal\test\tisinterface.class Generated: .\org\freepascal\test\tisclassbase.class Generated: .\org\freepascal\test\tisclassbase2.class Generated: .\org\freepascal\test\tisclass1.class Generated: .\org\freepascal\test\tisclass1$tisclass1nested.class Generated: .\org\freepascal\test\tisclass1$tisclass1nested$test__fpc_intern_recname_37.class Generated: .\org\freepascal\test\tisclass1$tisclass1nested$tisclass1nestedl2.class Generated: .\org\freepascal\test\tisclass1$tisclass1nested$tisclass1nestedl2$test__fpc_intern_recname_43.class Generated: .\org\freepascal\test\tnestrec.class Generated: .\org\freepascal\test\test__fpc_intern_recname_68.class C:\Users\garet\Documents\programming\fpc-opts\tests\test\jvm>javac -encoding utf-8 -cp ..\..\..\rtl\units\jvm-java;. JavaClass 'javac' is not recognized as an internal or external command, operable program or batch file. C:\Users\garet\Documents\programming\fpc-opts\tests\test\jvm>java -Dfile.encoding=UTF-8 -cp ..\..\..\rtl\units\jvm-java;. JavaClass Error: Could not find or load main class JavaClass C:\Users\garet\Documents\programming\fpc-opts\tests\test\jvm>if 1 NEQ 0 exit /b 1 I'm able to run Shell scripts on my Windows machine thanks to having a bash client installed, but testall.sh closes immediately (and it doesn't give me a chance to view the error messages) but this is probably because I haven't specified any parameters. I tried the obvious TEST_FPC=../../../compiler/ppcjvm.exe, and PPC instead of TEST_FPC, but it still closed immediately. Sorry if this is painfully obvious stuff. I will master non-Windows stuff and all eventually! Gareth aka. Kit -- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] ConvUtils: ConvTypeToFamily and ConvFamilyToDescription conundrums
On Wed, Jun 8, 2022 at 11:43 AM Bart wrote: > And another observation: on Delphi 7 TConvType seems to be unsiged (in > fpc it's signed). Actually it is documented to be of type Word: https://docwiki.embarcadero.com/Libraries/Sydney/en/System.ConvUtils.TConvType. I guess nobody needs more than 65536 conversion types, so most likely not a problem. So, this is not an implementation detail (which we could simply ignore), but actually it is now a bug. Changing our TConvType to word will potentially break existing programs though. Consider the following code: uses convutils,sysutils; var Fam: TConvFamily; Fams: TConvFamilyArray; Len: Integer; begin GetConvFamilies(Fams); Len := Length(Fams); if (Len=0) then writeln('Nothing registered yet'); for Fam := Low(Fams) to High(Fams) do writeln(format('%d: "%s"',[ord(fam),ConvFamilyToDescription(fam)])); end. If Len=0 this then High(Fams) will be Word(-1) and the loop will print 65536 non-existing families. (Which is why you should always use signed integers in a for loop) All this leads me to the conclusion that they (the Greek) did not really desing this unit very well. -- Bart ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] ConvUtils: ConvTypeToFamily and ConvFamilyToDescription conundrums
On Wed, Jun 8, 2022 at 11:43 AM Bart wrote: > > And another observation: on Delphi 7 TConvType seems to be unsiged (in > fpc it's signed). And as a consequence compilation in Delphi fails if a negative value is supplied to a function that takes a TConvType as a parameter, but also code like this will not raise an exception Delphi, while it does in Fpc: var L: Integer; begin L:=-1; writeln('ConvTypeToDescription(L)=',ConvTypeToDescription(L)); // prints [$] in D7, EAccessViolation in fpc end. -- Bart ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] JVM testing on x86_64
On 2022-06-08 14:42, J. Gareth Moreton via fpc-devel wrote: on x86_64-win64 after downloading the necessary runtimes, but how do I run the test suite for jvm-java? erroru.pp(25,3) Fatal: Unknown compilerproc "fpc_get_output". Check if you use the correct run time library. Fatal: Compilation aborted The JVM backend does not support the full RTL nor all language constructs: https://wiki.freepascal.org/FPC_JVM/Language There is a limited JVM-only testsuite in tests/test/jvm that you check with the testall.sh script in that directory (or testall.bat, but I'm not sure that one is completely up-to-date). Jonas ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[fpc-devel] JVM testing on x86_64
Hi everyone, So since a large number of my new optimisations do things at the nodal level, I need to do much more extensive testing. One thing that was brought up was testing JVM and LLVM. I've managed to build "ppcjvm" on x86_64-win64 after downloading the necessary runtimes, but how do I run the test suite for jvm-java? erroru.pp(25,3) Fatal: Unknown compilerproc "fpc_get_output". Check if you use the correct run time library. Fatal: Compilation aborted There is a jvmbackend branch, but it's 10 years stale and I figured there's a better way of going about it. Do I need to build the RTL in a certain way or add a specific parameter or directory to the "make full" call to run the test suite? Gareth aka. Kit -- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] ConvUtils: ConvTypeToFamily and ConvFamilyToDescription conundrums
And another observation: on Delphi 7 TConvType seems to be unsiged (in fpc it's signed). -- Bart ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[fpc-devel] ConvUtils: ConvTypeToFamily and ConvFamilyToDescription conundrums
Hi, I've been trying to improve the ConvUtils unit. Now I've ran into a problem. ConvTypeToFamily returns CIllegalConvFamily (=0) if AType is not registered. This however is a problem. If AType is a type registered in the first registered family, ConvTypeToFamily will also return 0. This means that the result value of ConvTypeToFamily cannot be used to determine wether or not AType actually is registered. This is IMHO not good. Related to this is the fact that in Delphi ConvFamilyToDescription(0) will return the strng "Illegal family" always, wether or not any families have been registered. (Tested with Delphi 7) = code begin == program dconv; {$apptype console} {$ifdef fpc} {$mode objfpc}{$h+} {$endif} uses sysutils,convutils; procedure ListFamilies; var Fam, FirstFam, SecFam: TConvFamily; Fams: TConvFamilyArray; tuFirstType, tuSecType: TConvType; Len, ExpLen: Integer; begin GetConvFamilies(Fams); Len := Length(Fams); if (Len=0) then writeln('Nothing registered yet'); writeln('Length(Fams)=',Len); if Len>0 then begin for Fam := Low(Fams) to High(Fams) do writeln(format('%d: "%s"',[ord(fam),ConvFamilyToDescription(fam)])); end else begin writeln('Testing with out of bound values'); writeln('ConvFamilyToDescription(0)="',ConvFamilyToDescription(0),'"'); writeln('ConvFamilyToDescription(1)="',ConvFamilyToDescription(1),'"'); end; writeln; writeln('Registering First and Second Family'); FirstFam := RegisterConversionFamily('First Family'); tuFirstType := RegisterConversionType(FirstFam, 'FirstType', 123.0); SecFam := RegisterConversionFamily('Second Family'); tuSecType := RegisterConversionType(SecFam, 'SecondType', 321.0); GetConvFamilies(Fams); ExpLen := Len+2; Len := Length(Fams); write('Length(Fams)=',Len); if (Len<>ExpLen) then writeln(' FAIL: Expected ',ExpLen) else writeln; if Len>0 then begin for Fam := Low(Fams) to High(Fams) do writeln(format('%d: "%s"',[ord(fam),ConvFamilyToDescription(fam)])); end; writeln('ConvFamilyToDescription(0)="',ConvFamilyToDescription(0),'"'); end; begin {$ifdef fpc} writeln('FPC'); {$else} writeln('Delphi'); {$endif} ListFamilies; end. code end == Output in FPC: FPC Nothing registered yet Length(Fams)=0 Testing with out of bound values ConvFamilyToDescription(0)="" ConvFamilyToDescription(1)="" Registering First and Second Family Length(Fams)=2 0: "First Family" 1: "Second Family" ConvFamilyToDescription(0)="First Family" Output in Delphi: Delphi Nothing registered yet Length(Fams)=0 Testing with out of bound values ConvFamilyToDescription(0)="Illegal family" ConvFamilyToDescription(1)="[$0001]" Registering First and Second Family Length(Fams)=2 0: "Illegal family" 1: "First Family" ConvFamilyToDescription(0)="Illegal family" The output of Delphi (7) is obviously totally wrong. Before I can even start to try to fix this I really need to know how current Delphi actually behaves. As long as we want to have ConvTypeToFamily and CIllegalConvFamily compatible with Delphi, the function RegisterConversionFamily() should never return CIllegalConvFamily . I.o.w. the internal array should not start at 0 (or the 0-index should be filled with info that represents an illegal family). So, any fix would break Delphi compatibility? Q1: Can somebody test with a modern Delphi? Q2: Any comments on the pargraph above? -- Bart ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel