Просмотр исходного кода

Fix riscv32 compilation error introduced in last commit

git-svn-id: trunk@40323 -
pierre 6 лет назад
Родитель
Сommit
11851d274c
1 измененных файлов с 11 добавлено и 4 удалено
  1. 11 4
      compiler/riscv/nrvadd.pas

+ 11 - 4
compiler/riscv/nrvadd.pas

@@ -63,6 +63,13 @@ implementation
       ncon,nset,
       ncgutil,tgobj,rgobj,rgcpu,cgobj,hlcgobj;
 
+{$undef AVOID_OVERFLOW}
+{$ifopt Q+}
+  {$define AVOID_OVERFLOW}
+  const
+     low_value = {$ifdef CPUALU64} low(int64) {$else} low(longint) {$endif};
+{$endif}
+
     procedure trvaddnode.Cmp(signed: boolean);
       var
         flabel,tlabel: tasmlabel;
@@ -90,8 +97,8 @@ implementation
               if (right.location.loc=LOC_CONSTANT) and
                  { right.location.value might be $8000000000000000, 
                    and its minus value generates an overflow here }
-                 {$ifopt Q+} ((right.location.value = int64($8000000000000000)) or {$endif}
-                 (not is_imm12(-right.location.value)) {$ifopt Q+}){$endif} then
+                 {$ifdef AVOID_OVERFLOW} ((right.location.value = low_value) or {$endif}
+                 (not is_imm12(-right.location.value)) {$ifdef AVOID_OVERFLOW}){$endif} then
                 hlcg.location_force_reg(current_asmdata.CurrAsmList,right.location,right.resultdef,right.resultdef,false);
 
               if right.location.loc=LOC_CONSTANT then
@@ -108,8 +115,8 @@ implementation
               if (right.location.loc=LOC_CONSTANT) and
                  { right.location.value might be $8000000000000000, 
                    and its minus value generates an overflow here }
-                 {$ifopt Q+} ((right.location.value = int64($8000000000000000)) or {$endif}
-                 (not is_imm12(-right.location.value)) {$ifopt Q+}){$endif} then
+                 {$ifdef AVOID_OVERFLOW} ((right.location.value = low_value) or {$endif}
+                 (not is_imm12(-right.location.value)) {$ifdef AVOID_OVERFLOW}){$endif} then
                 hlcg.location_force_reg(current_asmdata.CurrAsmList,right.location,right.resultdef,right.resultdef,false);
 
               if right.location.loc=LOC_CONSTANT then