[fpc-pascal] EControlC instead of EZeroDivide when using SSE instructions
OBones
obones at free.fr
Wed Aug 22 14:31:01 CEST 2012
Jonas Maebe wrote:
>
> OBones wrote on Wed, 22 Aug 2012:
>
>> Jonas Maebe wrote:
>>>
>>> You can try debugging syswin32_i386_exception_handler in
>>> rtl/win32/system.pp to see what exception Win32 reports instead.
>> Thanks for the confirmation as I was heading that way when I posted
>> the message, without much hope.
>> But now that I have put that idea to full length, it became clear
>> that the problem is not (entirely) with Win32 but because the
>> exception handler does not handle the STATUS_FLOAT_MULTIPLE_FAULTS
>> and STATUS_FLOAT_MULTIPLE_TRAPS cases.
>
> I guess you mean "a division by zero using an SSE instruction results
> in STATUS_FLOAT_MULTIPLE_FAULTS and/or STATUS_FLOAT_MULTIPLE_TRAPS"?
Yes, that's it, sorry for not making it clearer.
>> And as you said, when it does not know what to do, it gives 217 that
>> gets later translated to Control C, which to me is a bit misleading.
>> I'd rather have a 202, External Exception.
>
> 202 is "stack overflow". 217 is also used in the RTL as "unhandled
> exception". I don't know how come that this code is used both for
> ctrl-c and unhandled exception. Probably a simple error from a long
> time ago that never got corrected.
Woops, typo, I meant 212, as can be found in RunErrorToExcept from
sysutils.inc. That's where the Control C is coming from by the way.
>> So right, now, using this I'm getting the appropriate exception, I'm
>> just left wondering if this code (or a similar one) should be added
>> to FreePascal so that other people are not having the same issue as
>> I'm having.
>
> Probably. At least a quick web search seems to indicate this is a
> fairly well-known problem with SSE exceptions and Win32.
Well, once one knows about the multiple traps/multiple faults, yes, it's
easy to find it. But when starting from just a control C, it's much more
complex.
Once again, thanks for your help.
Olivier
More information about the fpc-pascal
mailing list