Commit c59b6a5d authored by Sven/Sarah Barth's avatar Sven/Sarah Barth
Browse files

* High() and Length() for dynamic arrays deal with sizesinttype instead of...

* High() and Length() for dynamic arrays deal with sizesinttype instead of ossinttype (on AVR the former is 16-bit while the later is 8-bit thus this is an important distinction)
parent c062061d
Pipeline #450901744 passed with stages
in 20 minutes and 13 seconds
......@@ -295,7 +295,7 @@ implementation
if is_widestring(left.resultdef) then
lendef:=u32inttype
else
lendef:=ossinttype;
lendef:=sizesinttype;
{ volatility of the ansistring/widestring refers to the volatility of the
string pointer, not of the string data }
hlcg.reference_reset_base(href,left.resultdef,left.location.register,-lendef.size,ctempposinvalid,lendef.alignment,[]);
......@@ -338,12 +338,12 @@ implementation
hlcg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,left.resultdef,OC_EQ,0,left.location.register,nillab);
{ volatility of the dyn. array refers to the volatility of the
string pointer, not of the string data }
hlcg.reference_reset_base(href,left.resultdef,left.location.register,-ossinttype.size,ctempposinvalid,ossinttype.alignment,[]);
hlcg.reference_reset_base(href,left.resultdef,left.location.register,-sizesinttype.size,ctempposinvalid,ossinttype.alignment,[]);
{ if the string pointer is nil, the length is 0 -> reuse the register
that originally held the string pointer for the length, so that we
can keep the original nil/0 as length in that case }
hregister:=cg.makeregsize(current_asmdata.CurrAsmList,left.location.register,def_cgsize(resultdef));
hlcg.a_load_ref_reg(current_asmdata.CurrAsmList,ossinttype,resultdef,href,hregister);
hlcg.a_load_ref_reg(current_asmdata.CurrAsmList,sizesinttype,resultdef,href,hregister);
hlcg.a_jmp_always(current_asmdata.CurrAsmList,donelab);
cg.a_label(current_asmdata.CurrAsmList,nillab);
......
......@@ -3201,7 +3201,7 @@ if (def.typ=recorddef) and not (m_delphi in current_settings.modes
if is_shortstring(left.resultdef) then
resultdef:=u8inttype
else
resultdef:=ossinttype;
resultdef:=sizesinttype;
end;
in_typeinfo_x:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment