Forráskód Böngészése

* 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 éve
szülő
commit
6878ffbf04
2 módosított fájl, 6 hozzáadás és 0 törlés
  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
                begin
                  { 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
                    the result also unsigned. This is compatible with Delphi (PFV) }
                  if is_signed(ld) or
                     is_signed(rd) or
+{$if defined(cpu16bitalu)}
+                    (m_tp7 in current_settings.modeswitches) or
+{$endif}
                     (nodetype=subn) then
                    begin
                      inserttypeconv(right,sinttype);

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

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