From f42dffb36d435cb1d9fd17385451e40e9660c520 Mon Sep 17 00:00:00 2001 From: marco Date: Mon, 12 Nov 2018 08:36:43 +0000 Subject: [PATCH] --- Merging r39877 into '.': U compiler/x86_64/rax64att.pas --- Recording mergeinfo for merge of r39877 into '.': U . --- Merging r39882 into '.': U compiler/nld.pas A tests/webtbf/tw34355.pp --- Recording mergeinfo for merge of r39882 into '.': G . --- Merging r39885 into '.': U compiler/ncgrtti.pas --- Recording mergeinfo for merge of r39885 into '.': G . # revisions: 39877,39882,39885 git-svn-id: branches/fixes_3_2@40286 - --- .gitattributes | 1 + compiler/ncgrtti.pas | 69 ++++++++++++++++-------------------- compiler/nld.pas | 3 +- compiler/x86_64/rax64att.pas | 2 +- tests/webtbf/tw34355.pp | 17 +++++++++ 5 files changed, 51 insertions(+), 41 deletions(-) create mode 100644 tests/webtbf/tw34355.pp diff --git a/.gitattributes b/.gitattributes index 54cb48c4fd..8647805498 100644 --- a/.gitattributes +++ b/.gitattributes @@ -14562,6 +14562,7 @@ tests/webtbf/tw3375.pp svneol=native#text/plain tests/webtbf/tw3393.pp svneol=native#text/plain tests/webtbf/tw3395.pp svneol=native#text/plain tests/webtbf/tw3395a.pp svneol=native#text/plain +tests/webtbf/tw34355.pp svneol=native#text/pascal tests/webtbf/tw3450.pp svneol=native#text/plain tests/webtbf/tw3473.pp svneol=native#text/plain tests/webtbf/tw3480.pp svneol=native#text/plain diff --git a/compiler/ncgrtti.pas b/compiler/ncgrtti.pas index 6ed1ce0892..de5ab94cc3 100644 --- a/compiler/ncgrtti.pas +++ b/compiler/ncgrtti.pas @@ -1339,40 +1339,32 @@ implementation procedure write_para(parasym:tparavarsym); begin - { only store user visible parameters } - if not(vo_is_hidden_para in parasym.varoptions) then - begin - { write flags for current parameter } - write_param_flag(tcb,parasym); - { write name of current parameter } - tcb.emit_shortstring_const(parasym.realname); - { write name of type of current parameter } - write_rtti_name(tcb,parasym.vardef); - end; + { write flags for current parameter } + write_param_flag(tcb,parasym); + { write name of current parameter } + tcb.emit_shortstring_const(parasym.realname); + { write name of type of current parameter } + write_rtti_name(tcb,parasym.vardef); end; procedure write_procedure_param(parasym:tparavarsym); begin - { only store user visible parameters } - if not(vo_is_hidden_para in parasym.varoptions) then - begin - { every parameter is expected to start aligned } - tcb.begin_anonymous_record( - internaltypeprefixName[itp_rtti_proc_param]+tostr(length(parasym.realname)), - defaultpacking,min(reqalign,SizeOf(PInt)), - targetinfos[target_info.system]^.alignment.recordalignmin, - targetinfos[target_info.system]^.alignment.maxCrecordalign); - { write flags for current parameter } - write_param_flag(tcb,parasym); - { write param type } - if is_open_array(parasym.vardef) or is_array_of_const(parasym.vardef) then - write_rtti_reference(tcb,tarraydef(parasym.vardef).elementdef,fullrtti) - else - write_rtti_reference(tcb,parasym.vardef,fullrtti); - { write name of current parameter } - tcb.emit_shortstring_const(parasym.realname); - tcb.end_anonymous_record; - end; + { every parameter is expected to start aligned } + tcb.begin_anonymous_record( + internaltypeprefixName[itp_rtti_proc_param]+tostr(length(parasym.realname)), + defaultpacking,min(reqalign,SizeOf(PInt)), + targetinfos[target_info.system]^.alignment.recordalignmin, + targetinfos[target_info.system]^.alignment.maxCrecordalign); + { write flags for current parameter } + write_param_flag(tcb,parasym); + { write param type } + if is_open_array(parasym.vardef) or is_array_of_const(parasym.vardef) then + write_rtti_reference(tcb,tarraydef(parasym.vardef).elementdef,fullrtti) + else + write_rtti_reference(tcb,parasym.vardef,fullrtti); + { write name of current parameter } + tcb.emit_shortstring_const(parasym.realname); + tcb.end_anonymous_record; end; var @@ -1392,7 +1384,7 @@ implementation { write parameter info. The parameters must be written in reverse order if this method uses right to left parameter pushing! } - tcb.emit_ord_const(def.maxparacount,u8inttype); + tcb.emit_ord_const(def.paras.count,u8inttype); for i:=0 to def.paras.count-1 do write_para(tparavarsym(def.paras[i])); @@ -1412,13 +1404,12 @@ implementation { enclosing record takes care of alignment } { write params typeinfo } for i:=0 to def.paras.count-1 do - if not(vo_is_hidden_para in tparavarsym(def.paras[i]).varoptions) then - begin - if is_open_array(tparavarsym(def.paras[i]).vardef) or is_array_of_const(tparavarsym(def.paras[i]).vardef) then - write_rtti_reference(tcb,tarraydef(tparavarsym(def.paras[i]).vardef).elementdef,fullrtti) - else - write_rtti_reference(tcb,tparavarsym(def.paras[i]).vardef,fullrtti); - end; + begin + if is_open_array(tparavarsym(def.paras[i]).vardef) or is_array_of_const(tparavarsym(def.paras[i]).vardef) then + write_rtti_reference(tcb,tarraydef(tparavarsym(def.paras[i]).vardef).elementdef,fullrtti) + else + write_rtti_reference(tcb,tparavarsym(def.paras[i]).vardef,fullrtti); + end; tcb.end_anonymous_record; end else @@ -1436,7 +1427,7 @@ implementation { write result typeinfo } write_rtti_reference(tcb,def.returndef,fullrtti); { write parameter count } - tcb.emit_ord_const(def.maxparacount,u8inttype); + tcb.emit_ord_const(def.paras.count,u8inttype); for i:=0 to def.paras.count-1 do write_procedure_param(tparavarsym(def.paras[i])); tcb.end_anonymous_record; diff --git a/compiler/nld.pas b/compiler/nld.pas index 1f9eb7b9b2..262271ae51 100644 --- a/compiler/nld.pas +++ b/compiler/nld.pas @@ -643,7 +643,8 @@ implementation ( (right.nodetype=arrayconstructorn) and (right.resultdef.typ=arraydef) and - (tarraydef(right.resultdef).elementdef=voidtype) + (tarraydef(right.resultdef).elementdef=voidtype) and + tarrayconstructornode(right).isempty ) ) then begin diff --git a/compiler/x86_64/rax64att.pas b/compiler/x86_64/rax64att.pas index e7d4cc8245..510288c0aa 100644 --- a/compiler/x86_64/rax64att.pas +++ b/compiler/x86_64/rax64att.pas @@ -185,7 +185,7 @@ Unit rax64att; Consume(AS_COMMA); hnum:=BuildConstExpression(false,false); if (hnum<0) or (hnum>maxoffset[actsehdirective=ash_setframe]) or - ((hnum mod modulo[actsehdirective=ash_setframe])<>0) then + ((hnum and modulo[actsehdirective=ash_setframe])<>0) then Message1(asmr_e_bad_seh_directive_offset,sehdirectivestr[actsehdirective]) else curlist.concat(cai_seh_directive.create_reg_offset(actsehdirective,hreg,hnum)); diff --git a/tests/webtbf/tw34355.pp b/tests/webtbf/tw34355.pp new file mode 100644 index 0000000000..167e59dd77 --- /dev/null +++ b/tests/webtbf/tw34355.pp @@ -0,0 +1,17 @@ +{ %fail } + +program tw34355; +{$mode objfpc} +procedure AssignArray(const aArray: array of string); +var + myArray: array of string; + S: string; +begin + myArray := [aArray]; // << no compiler error, yet no assignment is executed + Writeln('Length(myArray): ', Length(myArray)); + for S in myArray do + Writeln(S); +end; +begin + AssignArray(['abc', 'xyz']); +end.