[fpc-devel] 64 bit version problem

Miklos Cserzo cserzo at puskin.sote.hu
Fri Jan 25 16:30:00 CET 2008


Hi Folks,

I have a 32 bit system running openSUSE 10.3 with FPC 2.2.0 installed on 
it. On the other system the 64 bit variants installed of the OS and the 
compiler. I have a code that compiles and runs fine in the 32 bit 
environment. The same code compiles on 64-bit but it hits a division by 
zero for the same input that works on 32-bit. The compiler distributions 
are downloaded from the official FPC site as RPM packages. It looks like 
a real bad bug on 64-bit platform.

I traced back the problem to a line looking like:

score:= score + martix[vector[i,table[i,k]],vector[j,table[j,k]]];

The nested indirect reference above always results zero and this is the 
final cause of the fail.

When I restructure the code as:

begin
	x:=table[i,k];
	y:=table[j,k];
	a:=vector[i,x];
	b:=vector[j,y];
	score:= score + matrix[a,b];
end;

'score' gets non-zero value but the result is not realistic compared to 
the result of the 32-bit variant.

Then I coded a short sample source using similar structures as in the 
original in a hope to reproduce the fail. Unfortunately the code 
compiles and runs on both of the platforms, however, gives different 
results.

I guess the real problem is well before the critical line but I have no 
idea where could it be and how to find it. Now I wonder, if the same 
code supposed to compile and run in the same manner on 32 and 64 bit 
architecture? Is this sort of anomaly a known problem? Can you advice me 
how to locate the problem? Is there a command line switch instructing 
the compiler to generate 32-bit executable on 64-bit environment? If 
not, can the two versions of the complier coexists in parallel?

Cheers,

miklos



More information about the fpc-devel mailing list