Browse Source

* do not optimize away +0.0 if no fastmath is passed as -0.0+(+0.0)=+0.0

florian 3 years ago
parent
commit
95dfccbb5e
1 changed files with 6 additions and 2 deletions
  1. 6 2
      compiler/nadd.pas

+ 6 - 2
compiler/nadd.pas

@@ -1062,8 +1062,12 @@ implementation
                         case nodetype of
                           addn:
                             begin
-                              result:=right.getcopy;
-                              exit;
+                              { -0.0+(+0.0)=+0.0 so we cannot carry out this optimization if no fastmath is passed }
+                              if not(cs_opt_fastmath in current_settings.optimizerswitches) then
+                                begin
+                                  result:=right.getcopy;
+                                  exit;
+                                end;
                             end;
                           slashn,
                           muln: