From adaeb0fc730d3a23679bfa2dc5ac96446e5e4a6d Mon Sep 17 00:00:00 2001 From: yury Date: Tue, 22 Apr 2008 08:45:50 +0000 Subject: [PATCH] * Strip result if inc/dec is performed in register on value less than 32-bit on ARM. (bug #10515) * Updated tcnvint6 to test this issue. git-svn-id: trunk@10753 - --- compiler/arm/narminl.pas | 11 ++++++++ tests/test/cg/tcnvint6.pp | 57 +++++++++++++++++++++++++-------------- 2 files changed, 48 insertions(+), 20 deletions(-) diff --git a/compiler/arm/narminl.pas b/compiler/arm/narminl.pas index aa84b0a47f..c9abdc4293 100644 --- a/compiler/arm/narminl.pas +++ b/compiler/arm/narminl.pas @@ -49,6 +49,7 @@ interface procedure second_sin_real; override; } procedure second_prefetch; override; + procedure second_incdec; override; private procedure load_fpu_location; end; @@ -223,6 +224,16 @@ implementation end; end; + + procedure tarminlinenode.second_incdec; + begin + inherited second_incdec; + { Strip result if inc/dec is performed in register on value less than 32-bit } + with tcallparanode(left).left.location do + if (loc in [LOC_REGISTER,LOC_CREGISTER]) and (tcgsize2size[size]$fe then error(7); {$endif FPC} + b2:=$fe; + if b<>b2 then + error(8); w:=$8000; if shortint(w)<>0 then @@ -54,6 +57,9 @@ begin if qword(w)<>$fffe then error(17); {$endif FPC} + w2:=$fffe; + if w<>w2 then + error(18); c:=$ffffffff; Inc(c,$ffffffff); @@ -63,32 +69,43 @@ begin if qword(c)<>$fffffffe then error(22); {$endif FPC} + c2:=$fffffffe; + if c<>c2 then + error(23); - shi:=-1; - if word(shi)<>$ffff then + shi:=$7f; + Inc(shi,$7f); + if word(shi)<>$fffe then error(31); - if cardinal(shi)<>$ffffffff then + if cardinal(shi)<>$fffffffe then error(32); i64:=cardinal(shi); - if i64<>$ffffffff then + if i64<>$fffffffe then error(33); {$ifdef FPC} - if qword(shi)<>$ffffffffffffffff then + if qword(shi)<>$fffffffffffffffe then error(34); {$endif FPC} - - si:=-1; - if word(si)<>$ffff then + shi2:=-2; + if shi<>shi2 then error(35); - if cardinal(si)<>$ffffffff then - error(36); + + si:=$7fff; + Inc(si,$7fff); + if word(si)<>$fffe then + error(41); + if cardinal(si)<>$fffffffe then + error(42); i64:=cardinal(si); - if i64<>$ffffffff then - halt(37); + if i64<>$fffffffe then + halt(43); {$ifdef FPC} - if qword(si)<>$ffffffffffffffff then - error(38); + if qword(si)<>$fffffffffffffffe then + error(44); {$endif FPC} + si2:=-2; + if si<>si2 then + error(45); writeln('Test OK.'); end.