Browse Source

* fixed tcgtypeconvnode.second_cstring_to_pchar for i8086 far data memory models by using the high level code generator

git-svn-id: trunk@27324 -
nickysn 11 years ago
parent
commit
0aab7fcc9c
1 changed files with 9 additions and 7 deletions
  1. 9 7
      compiler/ncgcnv.pas

+ 9 - 7
compiler/ncgcnv.pas

@@ -273,19 +273,21 @@ interface
       begin
       begin
          if left.nodetype<>stringconstn then
          if left.nodetype<>stringconstn then
            internalerror(200601131);
            internalerror(200601131);
-         location_reset(location,LOC_REGISTER,OS_ADDR);
+         if not is_pchar(resultdef) and not is_pwidechar(resultdef) then
+           internalerror(2014032802);
+         location_reset(location,LOC_REGISTER,def_cgsize(resultdef));
          case tstringconstnode(left).cst_type of
          case tstringconstnode(left).cst_type of
            cst_conststring :
            cst_conststring :
              begin
              begin
-               location.register:=cg.getaddressregister(current_asmdata.CurrAsmList);
-               cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,left.location.reference,location.register);
+               location.register:=hlcg.getaddressregister(current_asmdata.CurrAsmList,resultdef);
+               hlcg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,left.resultdef,resultdef,left.location.reference,location.register);
              end;
              end;
            cst_shortstring :
            cst_shortstring :
              begin
              begin
                inc(left.location.reference.offset);
                inc(left.location.reference.offset);
                location.reference.alignment:=1;
                location.reference.alignment:=1;
-               location.register:=cg.getaddressregister(current_asmdata.CurrAsmList);
-               cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,left.location.reference,location.register);
+               location.register:=hlcg.getaddressregister(current_asmdata.CurrAsmList,resultdef);
+               hlcg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,left.resultdef,resultdef,left.location.reference,location.register);
              end;
              end;
            cst_widestring,
            cst_widestring,
            cst_unicodestring,
            cst_unicodestring,
@@ -296,8 +298,8 @@ interface
                   { FPC_EMPTYCHAR is a widechar -> 2 bytes }
                   { FPC_EMPTYCHAR is a widechar -> 2 bytes }
                   reference_reset(hr,2);
                   reference_reset(hr,2);
                   hr.symbol:=current_asmdata.RefAsmSymbol('FPC_EMPTYCHAR');
                   hr.symbol:=current_asmdata.RefAsmSymbol('FPC_EMPTYCHAR');
-                  location.register:=cg.getaddressregister(current_asmdata.CurrAsmList);
-                  cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,hr,location.register);
+                  location.register:=hlcg.getaddressregister(current_asmdata.CurrAsmList,resultdef);
+                  hlcg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,left.resultdef,resultdef,hr,location.register);
                 end
                 end
                else
                else
                 begin
                 begin