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

* WebAssembly: fixed type conversion from pointer to qword (fixes bug #41092)

Nikolay Nikolov 5 месяцев назад
Родитель
Сommit
7c44300136
2 измененных файлов с 11 добавлено и 1 удалено
  1. 1 1
      compiler/wasm32/hlcgcpu.pas
  2. 10 0
      tests/webtbs/tw41092.pp

+ 1 - 1
compiler/wasm32/hlcgcpu.pas

@@ -1452,7 +1452,7 @@ implementation
       extra_slots:=prepare_stack_for_ref(list,tmpref,false);
       a_load_ref_stack(list,fromsize,tmpref,extra_slots);
 
-      if def2regtyp(fromsize)=R_INTREGISTER then
+      if def2regtyp(fromsize) in [R_INTREGISTER,R_ADDRESSREGISTER] then
         resize_stack_int_val(list,fromsize,tosize,false);
       a_load_stack_reg(list,tosize,register);
     end;

+ 10 - 0
tests/webtbs/tw41092.pp

@@ -0,0 +1,10 @@
+{$mode objfpc}
+{$H+}
+
+var
+  A: QWord;
+  B: Pointer;
+
+begin
+  A := QWord(B);
+end.