浏览代码

* insert a type conversion if the final result of an queued expression is
different from the type of typed constant/initialised data

git-svn-id: branches/hlcgllvm@28146 -

Jonas Maebe 11 年之前
父节点
当前提交
fc7d5e2254
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      compiler/llvm/nllvmtcon.pas

+ 6 - 0
compiler/llvm/nllvmtcon.pas

@@ -95,6 +95,12 @@ implementation
 
   procedure tllvmtai_typedconstbuilder.update_queued_tai(resdef: tdef; outerai, innerai: tai; newindex: longint);
     begin
+      { is the result of the outermost expression different from the type of
+        this typed const? -> insert type conversion }
+      if not assigned(fqueued_tai) and
+         (resdef<>fqueued_def) and
+         (llvmencodetype(resdef)<>llvmencodetype(fqueued_def)) then
+        queue_typeconvn(resdef,fqueued_def);
       if assigned(fqueued_tai) then
         begin
           taillvm(flast_added_tai).loadtai(fqueued_tai_opidx,outerai);