Просмотр исходного кода

+ also added stack underflow check in thlcgwasm.incstack (in case stack
height was already negative in the beginning, due to previous underflow)

Nikolay Nikolov 3 лет назад
Родитель
Сommit
a3610bfea1
1 измененных файлов с 7 добавлено и 0 удалено
  1. 7 0
      compiler/wasm32/hlcgcpu.pas

+ 7 - 0
compiler/wasm32/hlcgcpu.pas

@@ -318,6 +318,13 @@ implementation
 
   procedure thlcgwasm.incstack(list: TAsmList; slots: longint);
     begin
+      if (fevalstackheight<0) and
+         not(cs_no_regalloc in current_settings.globalswitches) then
+{$ifdef DEBUG_WASMSTACK}
+        list.concat(tai_comment.Create(strpnew('!!! stack underflow')));
+{$else DEBUG_WASMSTACK}
+        internalerror(2010120501);
+{$endif DEBUG_WASMSTACK}
       if slots=0 then
         exit;
       inc(fevalstackheight,slots);