[fpc-pascal] EControlC instead of EZeroDivide when using SSE instructions
Olivier SANNIER
obones at free.fr
Mon Aug 20 16:06:45 CEST 2012
Hello all,
I'm using FreePascal 2.6.0 under Win32 here and I'm seeing a very weird behavior
as I'm not getting EZeroDivide when doing float divisions, but a rather
surprising EControlC.
As I was writing the code in assembly, I also tried with plain Pascal code, but
I get the same result. Here is the code:
program test;
uses
classes,
sysutils;
procedure DirectTestExcept;
const
A: Double = 5;
B: Double = 0;
asm
movsd xmm0, A
divsd xmm0, B
end;
procedure MyTestExcept;
var
Tmp: Double;
begin
Tmp := 0.0;
Tmp := 5.0 / Tmp;
end;
begin
try
MyTestExcept;
except
on E: Exception do
WriteLn(E.ClassName + ': ' + E.Message);
end;
try
DirectTestExcept;
except
on E: Exception do
WriteLn(E.ClassName + ': ' + E.Message);
end;
end.
When I first saw the EControlC, I thought that maybe the initial exception was
eaten up, but it seems it's not the case because the above program gives this
output:
EControlC: Control-C hit
EControlC: Control-C hit
The command line used to compile is the following:
ppc386.exe -alt -gl -CF64 -Cfsse2 -Mdelphi test.dpr
Looking at the generated assembly, the pure pascal one uses the same operands
that my assembly, so it makes sense it behaves similarly.
Does any of you have any suggestion as to explain this behavior, and best of
all, how to fix it?
Regards
Olivier
More information about the fpc-pascal
mailing list