Ver código fonte

* 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)

Sven/Sarah Barth 3 anos atrás
pai
commit
c59b6a5d8d
2 arquivos alterados com 4 adições e 4 exclusões
  1. 3 3
      compiler/ncginl.pas
  2. 1 1
      compiler/ninl.pas

+ 3 - 3
compiler/ncginl.pas

@@ -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);

+ 1 - 1
compiler/ninl.pas

@@ -3201,7 +3201,7 @@ implementation
                   if is_shortstring(left.resultdef) then
                     resultdef:=u8inttype
                   else
-                    resultdef:=ossinttype;
+                    resultdef:=sizesinttype;
                 end;
 
               in_typeinfo_x: