[fpc-devel] error when crosscompile for arm

Jonas Maebe jonas.maebe at elis.ugent.be
Wed Dec 2 16:31:13 CET 2009


On 02 Dec 2009, at 16:19, Dariusz Mazur wrote:

> Jonas Maebe pisze:
>> On 02 Dec 2009, at 00:15, Dariusz Mazur wrote:
>>
>>> Jonas Maebe pisze:
>>>
>>> or compiler can use comp internal as int64 and external as real.
>>
>> That would result in precision loss.
>>
> Why. comp is 8 byte wide, the same as int64,

The precision loss occurs when treating it "external as real", because  
a double cannot represent all int64 values (it's also 8 bytes, but  
some of those 8 bytes are used to represent an exponent).

> As I read Delphi help now, comp is internal Intel int64, but is  
> classified as real, because it is not ordinal type.

The reason is because x87 fpu supports a signed 64 bit integer type  
(which Borland called "comp"). They introduced that type to allow  
people to perform fairly quick 64 bit arithmetic mathematics on the  
old Intel 16 bit processors, by making use of the floating point unit.  
That's the reason for the strange the definition and the non- 
portability.

>>> on linux-arm the same switch cause compiling error (problems with  
>>> units generating with different switch ) remark: all compiled with  
>>> -CfSOFT
>>
>> Compiling with -Cfsoft and {$E-} will indeed probably causes  
>> errors. The compiler should simply give an error when you try to do  
>> that.
>>
> Not simpler ignore this?

It may seem simpler at first sight, but putting "intelligence" like  
that in the compiler only makes the compiler's behaviour more complex  
to understand in the long run (if the compiler ignores what I'm doing  
here, under what other circumstances will it ignore things?) and more  
difficult to maintain.

> On other platforms  this is not enough, and more switches should be  
> added

I don't understand what you mean with this. Note that we do not  
support floating point emulation on all platforms.


Jonas





More information about the fpc-devel mailing list