Prof A Olowofoyeku (The African Chief) wrote:
I have built gpc-20040516 for AMD64 (platform: Fedora Core 2, 64-bit).
Binaries can be obtained here: http://gnu-pascal.de/contrib/chief/fedora-2/
Built and tested on an Athlon-64 3.2+, the testsuite ran fine, except for these: TEST asmtest.pas: SKIPPED: only for IA32 TEST az20.pas: ./test_run: line 334: 4929 Segmentation fault ./"$A_OUT" "$1" TEST confarr5.pas: ./test_run: line 334: 9516 Segmentation fault ./"$A_OUT" "$1" TEST fjf746.pas: ./test_run: line 334: 14662 Segmentation fault ./"$A_OUT" "$1" TEST fjf746.pas: ./test_run: line 334: 14662 Segmentation fault ./"$A_OUT" "$1" TEST jj5.pas: SKIPPED: `attribute (stdcall)' not available TEST martin3.pas: ./test_run: line 334: 27275 Segmentation fault ./"$A_OUT" "$1" TEST pack10.pas: ./test_run: line 334: 30277 Segmentation fault ./"$A_OUT" "$1" TEST pack5.pas: ./test_run: line 334: 30396 Segmentation fault ./"$A_OUT" "$1"
The failing tests are known problem: bit-packed arrays do not work on amd64 with 3.x backend. Fixed in 3.4.0. You do not mention `fjf762a.pas' -- I was convinced that is should fail on all 64-bit machines.
One curious thing. "Writeln (sizeof (Integer))" prints "4", as does "Writeln (sizeof (Cardinal))". Shouldn't these be 64-bit?
The manual promises that `Integer' is the same size as C `int'. AFAIK on most 64-bit machines `int' is 32 bit. The consequences of C brain damage are rather unpleasent: -- all use of 64 bit integers became non-standard -- string length is limited to 32 bits -- spurious overflows/truncations since procision by default is limited to 32 bits
On the other hand correcting the problem would break backwards compatibility. Simplest correction would be to say that Pascal `Integer' is equvalent to C `long'. Since on most 32-bit machines both `int' and `long' are 32 bits such a change would not affect popular systems 32-bit systems. Note that currently most m68k systems use 16-bit integers and change to 32 bits would correct many problems.
However, making `Integer' the same as C `long' also has drawbacks: -- 8 and 16 bit processors have 32-bit longs, which may be too large as default size -- AFAIK Microsoft decided to use 32-bit `long' on 64-bit processors (they wont to use `long long' as 64-bit type).
Alternatively, we can exlude Pascal `Integer' from compatibility rules and choose good size in the front end. Or we can make `Integer' the same size as C `size_t'.
I think that main question is if we are willing to break backwards compatibility. Since change in `Integer' size is quite serious difference we can not do this lightly.
Any thoughts?