I recently upgraded my application from Delphi 2007 to Delphi XE8. In couple of forms, Form.showmodel line throws "Floating point division by zero" exception. On those forms there is No arithmetic operations done at all.

I recently upgraded my application from Delphi 2007 to Delphi XE8. In couple of forms, Form.showmodel line throws "Floating point division by zero" exception. On those forms there is No arithmetic operations done at all.

I tried executing following code before showmodal which resolved the issue.

  var
  CW, SW: word;

  function GetX87CW: word;
    ASM
    FStCW [Result]
  End;

  Function GetX87SW: word; // Assembler;
    ASM
    FStSW [Result]
  End;

  CW := GetX87CW; SW := GetX87SW;

  ShowMessage(Format('CW = $%4x, SW = $%4x',[CW,SW]));

I haven't saved this code and commented out all code and again recompiled the application which also resolved the issue.

Now I closed Delphi and restarted the XE8 IDE. I opened the project and this issue started appearing again but this time, even though I wrote the above code, it still is throwing exception.

Have any one seen such issue and can someone throw some light on possible cause of such issue ?

Comments