瀏覽代碼

* fixed shortstring constant emission after r28210: the terminating #0
was no longer included, so things went wrong if the string was reused
for a pchar

git-svn-id: trunk@32738 -

Jonas Maebe 9 年之前
父節點
當前提交
aef6120438
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      compiler/ncgcon.pas

+ 2 - 2
compiler/ncgcon.pas

@@ -377,9 +377,9 @@ implementation
                           move(value_str^,pc[1],l);
                           move(value_str^,pc[1],l);
                           pc[0]:=chr(l);
                           pc[0]:=chr(l);
                           pc[l+1]:=#0;
                           pc[l+1]:=#0;
-                          datadef:=carraydef.getreusable(cansichartype,l+1);
+                          datadef:=carraydef.getreusable(cansichartype,l+2);
                           datatcb.maybe_begin_aggregate(datadef);
                           datatcb.maybe_begin_aggregate(datadef);
-                          datatcb.emit_tai(Tai_string.Create_pchar(pc,l+1),datadef);
+                          datatcb.emit_tai(Tai_string.Create_pchar(pc,l+2),datadef);
                           datatcb.maybe_end_aggregate(datadef);
                           datatcb.maybe_end_aggregate(datadef);
                           current_asmdata.asmlists[al_typedconsts].concatList(
                           current_asmdata.asmlists[al_typedconsts].concatList(
                             datatcb.get_final_asmlist(lastlabel.lab,datadef,sec_rodata_norel,lastlabel.lab.name,const_align(sizeof(pint)))
                             datatcb.get_final_asmlist(lastlabel.lab,datadef,sec_rodata_norel,lastlabel.lab.name,const_align(sizeof(pint)))