Ver código fonte

* only copy the shiftval field from the original para location when creating
a temporary parameter location if the original location was not a reference
(because in that case part of the reference overlaps with the shiftval
variant field, and if we optimise the temp location into a register,
this register will get a random/bogus shiftval)

git-svn-id: trunk@32599 -

Jonas Maebe 9 anos atrás
pai
commit
99361994b7
1 arquivos alterados com 5 adições e 1 exclusões
  1. 5 1
      compiler/paramgr.pas

+ 5 - 1
compiler/paramgr.pas

@@ -403,7 +403,11 @@ implementation
             newparaloc:=cgpara.add_location;
             newparaloc^.size:=paraloc^.size;
             newparaloc^.def:=paraloc^.def;
-            newparaloc^.shiftval:=paraloc^.shiftval;
+            { shiftval overlaps with part of the reference, so it may be
+              different from 0 and if wr then force the newparaloc to a register
+              in the optimization below, shiftval will remain <> 0 }
+            if not(paraloc^.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
+              newparaloc^.shiftval:=paraloc^.shiftval;
             { $warning maybe release this optimization for all targets?  }
             { released for all CPUs:
               i386 isn't affected anyways because it uses the stack to push parameters