Browse Source

* mask FPU exceptions during libxml initialization to avoid an fpu exception with newer libxml, resolves #40622

florian 1 year ago
parent
commit
4fd5237c0e
1 changed files with 10 additions and 1 deletions
  1. 10 1
      packages/libxml/src/xml2.pas

+ 10 - 1
packages/libxml/src/xml2.pas

@@ -20,10 +20,12 @@ interface
 uses
   System.DynLibs,
   System.CTypes;
+  System.Math;
 {$ELSE FPC_DOTTEDUNITS}
 uses
   dynlibs,
-  ctypes;
+  ctypes,
+  math;
 {$ENDIF FPC_DOTTEDUNITS}
 
 const
@@ -358,6 +360,9 @@ begin
 end;
 {$ENDIF}
 
+var
+  mask : TFPUExceptionMask;
+
 initialization
 {$IFDEF NO_EXTERNAL_VARS}
   LoadExternalVariables;
@@ -373,8 +378,12 @@ initialization
  * between the version it was compiled for and the actual shared
  * library used.
  *)
+  mask:=GetExceptionMask;
+  SetExceptionMask([exInvalidOp,exDenormalized,exZeroDivide,exOverflow,exUnderflow,exPrecision]);
+
   LIBXML_TEST_VERSION;
 
+  SetExceptionMask(mask);
 (*
  * overloading the error functions
  *)