Browse Source

* insert explicit typecast to left type of inc(left,right) before
assigning the value after an addn
* for inc(pointer,X) convert X to sinttype instead of ptrinttype
to support also negative values of X

git-svn-id: trunk@587 -

peter 20 years ago
parent
commit
6846195a6c
1 changed files with 2 additions and 1 deletions
  1. 2 1
      compiler/ninl.pas

+ 2 - 1
compiler/ninl.pas

@@ -2176,7 +2176,7 @@ implementation
                        hpp := cordconstnode.create(1,tcallparanode(left).left.resulttype,false);
                      end;
                    if (tcallparanode(left).left.resulttype.def.deftype=pointerdef) then
-                     inserttypeconv_internal(hpp,ptrinttype);
+                     inserttypeconv_internal(hpp,sinttype);
                    { make sure we don't call functions part of the left node twice (and generally }
                    { optimize the code generation)                                                }
                    if node_complexity(tcallparanode(left).left) > 1 then
@@ -2199,6 +2199,7 @@ implementation
                    else
                      hpp := caddnode.create(subn,hp,hpp);
                    { assign result of addition }
+                   inserttypeconv_internal(hpp,hp.resulttype);
                    addstatement(newstatement,cassignmentnode.create(hp.getcopy,hpp));
                    { deallocate the temp }
                    if assigned(tempnode) then