Browse Source

* only convert left/right to the resultdef of an addnode involving pointers
if the it's an addn/subn. For comparisons, the resultdef is boolean, and
left and right will already have the same type (with addn/subn, one could
be a pointer and the other an integer)

git-svn-id: trunk@32523 -

Jonas Maebe 9 years ago
parent
commit
6cf67b7ace
1 changed files with 2 additions and 1 deletions
  1. 2 1
      compiler/llvm/nllvmadd.pas

+ 2 - 1
compiler/llvm/nllvmadd.pas

@@ -87,7 +87,8 @@ implementation
         end
         end
       { pointer +/- integer -> make defs the same since a_op_* only gets a
       { pointer +/- integer -> make defs the same since a_op_* only gets a
         single type as argument }
         single type as argument }
-      else if (left.resultdef.typ=pointerdef)<>(right.resultdef.typ=pointerdef) then
+      else if (nodetype in [addn,subn]) and
+              ((left.resultdef.typ=pointerdef)<>(right.resultdef.typ=pointerdef)) then
         begin
         begin
           { the result is a pointerdef -> typecast both arguments to pointer;
           { the result is a pointerdef -> typecast both arguments to pointer;
             a_op_*_reg will convert them back to integer as needed }
             a_op_*_reg will convert them back to integer as needed }