Browse Source

* fixed WebAssembly overflow checking for 64-bit multiplication

Nikolay Nikolov 2 weeks ago
parent
commit
ccbebd6463
1 changed files with 11 additions and 0 deletions
  1. 11 0
      compiler/nadd.pas

+ 11 - 0
compiler/nadd.pas

@@ -4703,6 +4703,17 @@ const
                  else
                    expectloc:=LOC_JUMP;
               end
+{$elseif defined(wasm)}
+            { WebAssembly does not support overflow checking for 64-bit multiplication }
+            else if (torddef(ld).ordtype in [s64bit,u64bit,scurrency]) and
+                    (cs_check_overflow in current_settings.localswitches) and
+                    (nodetype = muln) then
+              begin
+                result := first_add64bitint;
+                if assigned(result) then
+                  exit;
+                expectloc:=LOC_REGISTER
+              end
 {$endif not(cpu64bitalu) and not(cpuhighleveltarget)}
              { generic 32bit conversion }
              else