Browse Source

* In the TP mode for 16-bit CPUs uint8+uint8 is extended to sint16+sint16. This is TP compatible.

git-svn-id: trunk@46468 -
yury 5 years ago
parent
commit
6878ffbf04
2 changed files with 6 additions and 0 deletions
  1. 4 0
      compiler/nadd.pas
  2. 2 0
      tests/test/cpu16/taddint1.pp

+ 4 - 0
compiler/nadd.pas

@@ -2263,10 +2263,14 @@ implementation
              else
              else
                begin
                begin
                  { When there is a signed type or there is a minus operation
                  { When there is a signed type or there is a minus operation
+                   or in TP mode for 16-bit CPUs
                    we convert to signed int. Otherwise (both are unsigned) we keep
                    we convert to signed int. Otherwise (both are unsigned) we keep
                    the result also unsigned. This is compatible with Delphi (PFV) }
                    the result also unsigned. This is compatible with Delphi (PFV) }
                  if is_signed(ld) or
                  if is_signed(ld) or
                     is_signed(rd) or
                     is_signed(rd) or
+{$if defined(cpu16bitalu)}
+                    (m_tp7 in current_settings.modeswitches) or
+{$endif}
                     (nodetype=subn) then
                     (nodetype=subn) then
                    begin
                    begin
                      inserttypeconv(right,sinttype);
                      inserttypeconv(right,sinttype);

+ 2 - 0
tests/test/cpu16/taddint1.pp

@@ -5,6 +5,8 @@
   This test is Turbo Pascal 7 compatible.
   This test is Turbo Pascal 7 compatible.
 }
 }
 
 
+{$mode tp}
+
 { Turn range checking off, as this test causes overflows intentionally to
 { Turn range checking off, as this test causes overflows intentionally to
   test the size and signedness of the integer that's being used. }
   test the size and signedness of the integer that's being used. }
 {$R-}
 {$R-}