Browse Source

* fixed wrong location.size (sign) for x86's in_abs_long + test

git-svn-id: trunk@10850 -
Jonas Maebe 17 years ago
parent
commit
3d2630c661
2 changed files with 20 additions and 2 deletions
  1. 2 2
      compiler/x86/nx86inl.pas
  2. 18 0
      tests/test/units/system/tabs.pp

+ 2 - 2
compiler/x86/nx86inl.pas

@@ -423,7 +423,7 @@ implementation
 {$ifdef i386}
 {$ifdef i386}
         if current_settings.cputype<cpu_Pentium2 then
         if current_settings.cputype<cpu_Pentium2 then
           begin
           begin
-            opsize:=int_cgsize(left.resultdef.size);
+            opsize:=def_cgsize(left.resultdef);
             secondpass(left);
             secondpass(left);
             location_force_reg(current_asmdata.CurrAsmList,left.location,opsize,false);
             location_force_reg(current_asmdata.CurrAsmList,left.location,opsize,false);
             location:=left.location;
             location:=left.location;
@@ -436,7 +436,7 @@ implementation
         else
         else
 {$endif i386}
 {$endif i386}
           begin
           begin
-            opsize:=int_cgsize(left.resultdef.size);
+            opsize:=def_cgsize(left.resultdef);
             secondpass(left);
             secondpass(left);
             location_force_reg(current_asmdata.CurrAsmList,left.location,opsize,true);
             location_force_reg(current_asmdata.CurrAsmList,left.location,opsize,true);
             hregister:=cg.getintregister(current_asmdata.CurrAsmList,opsize);
             hregister:=cg.getintregister(current_asmdata.CurrAsmList,opsize);

+ 18 - 0
tests/test/units/system/tabs.pp

@@ -167,6 +167,9 @@ procedure fail;
    _result : boolean;
    _result : boolean;
    value : longint;
    value : longint;
    value1: longint;
    value1: longint;
+   vsingle : single;
+   vdouble : double;
+   vextended : extended;
   begin
   begin
     Write('Abs() test with longint type...');
     Write('Abs() test with longint type...');
     _result := true;
     _result := true;
@@ -208,6 +211,21 @@ procedure fail;
     if value1 <> (RESULT_FOUR_INT) then
     if value1 <> (RESULT_FOUR_INT) then
        _result := false;
        _result := false;
 
 
+    value := VALUE_ONE_INT;
+    vsingle := abs(value);
+    if (round(vsingle) <> RESULT_ONE_INT) then
+      _result := false;
+
+    value := VALUE_ONE_INT;
+    vdouble := abs(value);
+    if (round(vdouble) <> RESULT_ONE_INT) then
+      _result := false;
+
+    value := VALUE_ONE_INT;
+    vextended := abs(value);
+    if (round(vextended) <> RESULT_ONE_INT) then
+      _result := false;
+
     if not _result then
     if not _result then
       fail
       fail
     else
     else