Browse Source

* Fixed tw11027.
* Updated tcnvint2 to new rules.

git-svn-id: trunk@10677 -

yury 17 years ago
parent
commit
24be2c31f7
2 changed files with 7 additions and 6 deletions
  1. 3 2
      compiler/ncgcnv.pas
  2. 4 4
      tests/test/cg/tcnvint2.pp

+ 3 - 2
compiler/ncgcnv.pas

@@ -447,8 +447,9 @@ interface
            second_bool_to_int
            second_bool_to_int
          else
          else
            begin
            begin
-             { remove nf_explicit to perform full conversion }
-             exclude(flags, nf_explicit);
+             if (resultdef.size<>left.resultdef.size) then
+               { remove nf_explicit to perform full conversion if boolean sizes are different }
+               exclude(flags, nf_explicit);
              second_int_to_bool;
              second_int_to_bool;
            end;
            end;
       end;
       end;

+ 4 - 4
tests/test/cg/tcnvint2.pp

@@ -112,12 +112,12 @@ begin
  Test('longint -> longbool : Value should be TRUE...',lb1);
  Test('longint -> longbool : Value should be TRUE...',lb1);
 {$ifndef tp}
 {$ifndef tp}
  fromint64 := $10000000;
  fromint64 := $10000000;
- lb1 := longbool(fromint64);
+ lb1 := longbool(qwordbool(fromint64));
  Test('int64 -> longbool : Value should be TRUE...',lb1);
  Test('int64 -> longbool : Value should be TRUE...',lb1);
  { does it indirectly, since it might not work in direct mode }
  { does it indirectly, since it might not work in direct mode }
  value:=1;
  value:=1;
  fromint64 := int64(value) shl int64(36) ;
  fromint64 := int64(value) shl int64(36) ;
- lb1 := longbool(fromint64);
+ lb1 := longbool(qwordbool(fromint64));
  Test('int64 -> longbool : Value should be TRUE...',lb1);
  Test('int64 -> longbool : Value should be TRUE...',lb1);
 {$endif}
 {$endif}
  { left : LOC_REGISTER  }
  { left : LOC_REGISTER  }
@@ -154,9 +154,9 @@ begin
  Test('longint -> longbool : Value should be TRUE...',lb1);
  Test('longint -> longbool : Value should be TRUE...',lb1);
 {$ifndef tp}
 {$ifndef tp}
  fromint64 := $10000000;
  fromint64 := $10000000;
- lb1 := longbool(getint64);
+ lb1 := longbool(qwordbool(getint64));
  Test('int64 -> longbool : Value should be TRUE...',lb1);
  Test('int64 -> longbool : Value should be TRUE...',lb1);
- lb1 := longbool(getint64_2);
+ lb1 := longbool(qwordbool(getint64_2));
  Test('int64 -> longbool : Value should be TRUE...',lb1);
  Test('int64 -> longbool : Value should be TRUE...',lb1);
 {$endif}
 {$endif}
  { left : LOC_FLAGS  }
  { left : LOC_FLAGS  }