[fpc-pascal] EControlC instead of EZeroDivide when using SSE instructions

Jonas Maebe jonas.maebe at elis.ugent.be
Wed Aug 22 14:10:32 CEST 2012


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"?

> 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.

> 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.


Jonas



More information about the fpc-pascal mailing list