From 91f29419a5fcaffbb09ad8a98957a91ef806aa8a Mon Sep 17 00:00:00 2001
From: Pierre Muller <pierre@freepascal.org>
Date: Tue, 25 Jan 2022 21:50:03 +0000
Subject: [PATCH] Avoid use of fastmath optimization inside compiler

---
 compiler/fpcdefs.inc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/compiler/fpcdefs.inc b/compiler/fpcdefs.inc
index fca7827fff..2f115e1e96 100644
--- a/compiler/fpcdefs.inc
+++ b/compiler/fpcdefs.inc
@@ -15,6 +15,11 @@
   exceptions in the constructors }
 {$IMPLICITEXCEPTIONS OFF}
 
+{ We don't want the compiler to use fastmath
+  optimization because it considers negative zeroes
+  as normal zeroes }
+{$OPTIMIZATION NOFASTMATH}
+
 { We don't want C operators to be used inside the compiler }
 {$COPERATORS OFF}