mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-10-31 06:31:34 +01:00 
			
		
		
		
	* 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 -
This commit is contained in:
		
							parent
							
								
									5ce1eb0dcb
								
							
						
					
					
						commit
						adaeb0fc73
					
				| @ -49,6 +49,7 @@ interface | |||||||
|         procedure second_sin_real; override; |         procedure second_sin_real; override; | ||||||
|         } |         } | ||||||
|         procedure second_prefetch; override; |         procedure second_prefetch; override; | ||||||
|  |         procedure second_incdec; override; | ||||||
|       private |       private | ||||||
|         procedure load_fpu_location; |         procedure load_fpu_location; | ||||||
|       end; |       end; | ||||||
| @ -223,6 +224,16 @@ implementation | |||||||
|           end; |           end; | ||||||
|       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]<sizeof(aint)) then | ||||||
|  |             cg.a_load_reg_reg(current_asmdata.CurrAsmList, size, OS_32, register, register) | ||||||
|  |       end; | ||||||
|  | 
 | ||||||
| begin | begin | ||||||
|   cinlinenode:=tarminlinenode; |   cinlinenode:=tarminlinenode; | ||||||
| end. | end. | ||||||
|  | |||||||
| @ -6,12 +6,12 @@ begin | |||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| var | var | ||||||
|   b: byte; |   b,b2: byte; | ||||||
|   w: word; |   w,w2: word; | ||||||
|   c: cardinal; |   c,c2: cardinal; | ||||||
|   shi: shortint; |   shi,shi2: shortint; | ||||||
|   si: smallint; |   si,si2: smallint; | ||||||
|   i64: int64; |   i64,i642: int64; | ||||||
| begin | begin | ||||||
|   b:=$ff; |   b:=$ff; | ||||||
|   Inc(b,$ff); |   Inc(b,$ff); | ||||||
| @ -31,6 +31,9 @@ begin | |||||||
|   if qword(b)<>$fe then |   if qword(b)<>$fe then | ||||||
|     error(7); |     error(7); | ||||||
| {$endif FPC} | {$endif FPC} | ||||||
|  |   b2:=$fe; | ||||||
|  |   if b<>b2 then | ||||||
|  |     error(8); | ||||||
| 
 | 
 | ||||||
|   w:=$8000; |   w:=$8000; | ||||||
|   if shortint(w)<>0 then |   if shortint(w)<>0 then | ||||||
| @ -54,6 +57,9 @@ begin | |||||||
|   if qword(w)<>$fffe then |   if qword(w)<>$fffe then | ||||||
|     error(17); |     error(17); | ||||||
| {$endif FPC} | {$endif FPC} | ||||||
|  |   w2:=$fffe; | ||||||
|  |   if w<>w2 then | ||||||
|  |     error(18); | ||||||
| 
 | 
 | ||||||
|   c:=$ffffffff; |   c:=$ffffffff; | ||||||
|   Inc(c,$ffffffff); |   Inc(c,$ffffffff); | ||||||
| @ -63,32 +69,43 @@ begin | |||||||
|   if qword(c)<>$fffffffe then |   if qword(c)<>$fffffffe then | ||||||
|     error(22); |     error(22); | ||||||
| {$endif FPC} | {$endif FPC} | ||||||
|  |   c2:=$fffffffe; | ||||||
|  |   if c<>c2 then | ||||||
|  |     error(23); | ||||||
| 
 | 
 | ||||||
|   shi:=-1; |   shi:=$7f; | ||||||
|   if word(shi)<>$ffff then |   Inc(shi,$7f); | ||||||
|  |   if word(shi)<>$fffe then | ||||||
|     error(31); |     error(31); | ||||||
|   if cardinal(shi)<>$ffffffff then |   if cardinal(shi)<>$fffffffe then | ||||||
|     error(32); |     error(32); | ||||||
|   i64:=cardinal(shi); |   i64:=cardinal(shi); | ||||||
|   if i64<>$ffffffff then |   if i64<>$fffffffe then | ||||||
|     error(33); |     error(33); | ||||||
| {$ifdef FPC} | {$ifdef FPC} | ||||||
|   if qword(shi)<>$ffffffffffffffff then |   if qword(shi)<>$fffffffffffffffe then | ||||||
|     error(34); |     error(34); | ||||||
| {$endif FPC} | {$endif FPC} | ||||||
| 
 |   shi2:=-2; | ||||||
|   si:=-1; |   if shi<>shi2 then | ||||||
|   if word(si)<>$ffff then |  | ||||||
|     error(35); |     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); |   i64:=cardinal(si); | ||||||
|   if i64<>$ffffffff then |   if i64<>$fffffffe then | ||||||
|     halt(37); |     halt(43); | ||||||
| {$ifdef FPC} | {$ifdef FPC} | ||||||
|   if qword(si)<>$ffffffffffffffff then |   if qword(si)<>$fffffffffffffffe then | ||||||
|     error(38); |     error(44); | ||||||
| {$endif FPC} | {$endif FPC} | ||||||
|  |   si2:=-2; | ||||||
|  |   if si<>si2 then | ||||||
|  |     error(45); | ||||||
| 
 | 
 | ||||||
|   writeln('Test OK.'); |   writeln('Test OK.'); | ||||||
| end. | end. | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 yury
						yury