Browse Source

* fix loading of constants in registers in the LLVM CG if the constant
does not fit in ptrsinttype

git-svn-id: trunk@41138 -

Jonas Maebe 6 years ago
parent
commit
e52cf555ab
1 changed files with 7 additions and 1 deletions
  1. 7 1
      compiler/llvm/hlcgllvm.pas

+ 7 - 1
compiler/llvm/hlcgllvm.pas

@@ -553,8 +553,14 @@ implementation
 
 
 
 
   procedure thlcgllvm.a_load_const_reg(list: TAsmList; tosize: tdef; a: tcgint; register: tregister);
   procedure thlcgllvm.a_load_const_reg(list: TAsmList; tosize: tdef; a: tcgint; register: tregister);
+    var
+      fromsize: tdef;
     begin
     begin
-      list.concat(taillvm.op_reg_size_const_size(llvmconvop(ptrsinttype,tosize,false),register,ptrsinttype,a,tosize))
+      if tosize.size<=ptrsinttype.size then
+        fromsize:=ptrsinttype
+      else
+        fromsize:=tosize;
+      list.concat(taillvm.op_reg_size_const_size(llvmconvop(fromsize,tosize,false),register,fromsize,a,tosize))
     end;
     end;