|
@@ -294,7 +294,7 @@ implementation
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
- { length in ansi/wide strings is at offset -sizeof(pint) }
|
|
|
+ { length in ansi/wide strings and high in dynamic arrays is at offset -sizeof(pint) }
|
|
|
hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,false);
|
|
|
current_asmdata.getjumplabel(lengthlab);
|
|
|
cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_ADDR,OC_EQ,0,left.location.register,lengthlab);
|
|
@@ -312,6 +312,11 @@ implementation
|
|
|
end;
|
|
|
if is_widestring(left.resultdef) then
|
|
|
cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SHR,OS_INT,1,hregister);
|
|
|
+
|
|
|
+ { Dynamic arrays do not have their length attached but their maximum index }
|
|
|
+ if is_dynamic_array(left.resultdef) then
|
|
|
+ cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_ADD,OS_INT,1,hregister);
|
|
|
+
|
|
|
cg.a_label(current_asmdata.CurrAsmList,lengthlab);
|
|
|
location_reset(location,LOC_REGISTER,def_cgsize(resultdef));
|
|
|
location.register:=hregister;
|