[fpc-pascal] Error in x32 compiler when using SSE3

OBones obones at free.fr
Mon May 28 16:09:18 CEST 2012


Jonas Maebe wrote:
> On 28 May 2012, at 15:19, OBones wrote:
>
>> Bugger, why does this keep happening to me???
>> Anyway, this time it is at the end.
> I cannot reproduce the problem with 2.6.0/2.7.1 on Mac OS X/i386, nor with 2.7.1 on Linux/i386. I even don't see any comis* instructions in the code, the comparison is performed by the x87 fpu because frac() returns an extended result on i386. The only way I can get a comisd, is
> a) when targeting Win64/x86-64, but then it's a "comisd reg,reg" instruction
> b) when compiling in ObjFPC mode rather than Delphi mode and compiling for i386, and adding an explicit double() typecast around the result of frac (that's not possible in Delphi mode, because Delphi does not allow changing the precision of floating point expressions via explicit typecasts). Then I do see a "comisd ref, reg", but it compiles fine here with 2.7.1 for Mac OS X/i386 and Linux/i386 (I don't have a 2.6.0 rtl for Linux or Win32 handy to test).
Boy, I'm having a hard day and I'm very sorry to make you waste so much 
time.
Frac was here to see the impact of some changes on the issue, but the 
original code that crashes is with Trunc instead of Frac so that the 
comparison looks like this:

   if Trunc(current/NS.VARIABLE) = current/NS.VARIABLE then

Once again, sorry for all the troubles.



More information about the fpc-pascal mailing list