Sfoglia il codice sorgente

* try_make_mul32to64: restore original node order if transformation failed
o this gets called by taddnode.pass_1, which caches the left/right
node types/resultdefs

git-svn-id: trunk@47158 -

Jonas Maebe 4 anni fa
parent
commit
0729340817
1 ha cambiato i file con 10 aggiunte e 2 eliminazioni
  1. 10 2
      compiler/nadd.pas

+ 10 - 2
compiler/nadd.pas

@@ -3569,12 +3569,16 @@ implementation
       var
         temp: tnode;
         leftoriginallysigned,
-        canbesignedconst, canbeunsignedconst: boolean;
+        canbesignedconst, canbeunsignedconst, swapped: boolean;
       begin
         result := false;
+        swapped := false;
         { make sure that if there is a constant, that it's on the right }
         if left.nodetype = ordconstn then
-          swapleftright;
+          begin
+            swapleftright;
+            swapped := true;
+          end;
         if is_32to64typeconv(left) then
           begin
             leftoriginallysigned:=is_signed(ttypeconvnode(left).left.resultdef);
@@ -3613,6 +3617,10 @@ implementation
                 result := true;
               end;
           end;
+        { pass_Typecheck caches left/right type and resultdef, so restore the
+          original order }
+        if not result and swapped then
+          swapleftright;
       end;