Explorar o código

* 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 %!s(int64=11) %!d(string=hai) anos
pai
achega
fc7d5e2254
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  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);
   procedure tllvmtai_typedconstbuilder.update_queued_tai(resdef: tdef; outerai, innerai: tai; newindex: longint);
     begin
     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
       if assigned(fqueued_tai) then
         begin
         begin
           taillvm(flast_added_tai).loadtai(fqueued_tai_opidx,outerai);
           taillvm(flast_added_tai).loadtai(fqueued_tai_opidx,outerai);